This entire chapter was poorly written and the code is just awful. It makes no sense to use one letter variables such as p, q, s. The author should have used list1, list2, smaller, and made code more readable.
Course: https://www.educative.io/collection/10370001/5474278013140992
Lesson: https://www.educative.io/collection/page/10370001/5474278013140992/5467613968728064