Comprehending comprehensions by Reuven M. Lerner

Comprehending comprehensions

Less Python code. More Python power.

Get access for $80


Comprehensions — list, dict, and set — are a powerful Python feature that make your code shorter, more efficient, and more expressive. However, a large number of Python developers think of comprehensions as nothing more than "for" loops with a hard-to-understand syntax, and avoid using them. That's a shame, because comprehensions aren't that hard, and are quite useful for solving a wide variety of problems.

This course will explores comprehensions, starting with the basic syntax and use cases, working up to nested comprehensions that allow us to solve more complex problems. The course includes a large number of hands-on exercises, as well as an even larger number of live-coding demos.

By the time the course is over, you will no longer wonder when or how to use comprehensions. Instead, you'll know how, when, and why to use comprehensions, making you a more fluent Python developer. 

The course includes:
  • Nearly two hours of video
  • More than 15 exercises
  • PDFs of the slides I use to teach this subject
  • Files used for exercises
  • The Jupyter notebook from my on-screen lectures

If you are a Python developer, and haven't yet figured out how, when, or when to use comprehensions, then this course is for you.  It'll allow you to do more in less time, and with less code.  It'll help you to tap into one of Python's most powerful tools, and understand code that others have written.

What's included?

Video Icon 22 videos File Icon 10 files


Section 1: Introduction
01 Intro and
3 mins
02 What is functional programming?.mov
13 mins
Section 2: List comprehensions
03 Intro to comprehensions.mp4
12 mins
04 Basic comprehension exercises.mp4
4 mins
406 Bytes
05 Basic comprehension exercise solutions.mp4
6 mins
06 More complex list comprehensions.mp4
10 mins
769 Bytes
07 Complex comprehension exercises.mp4
5 mins
08 Complex comprehension exercise solutions.mp4
9 mins
08a Complex comprehension exercise 4 solution.mp4
4 mins
Section 3: Set comprehensions
09 Set comprehensions.mp4
7 mins
10 Set comprehension exercises.mp4
2 mins
286 Bytes
11 Set comprehension exercise solutions.mp4
6 mins
Section 4: Dict comprehensions
12 Dict comprehensions.mp4
6 mins
13 Dict comprehension exercises.mp4
4 mins
1.04 KB
14 Dict comprehension exercise solutions.mp4
8 mins
Section 5: Nested comprehensions
15 Nested comprehensions.mp4
7 mins
16 Nested comprehension exercises.mp4
4 mins
535 Bytes
17 Nested comprehension exercise solutions.mp4
5 mins
Section 6: Shoe store exercise
18 Shoe store exercise.mp4
2 mins
241 Bytes
19 Shoe store exercise solution.mp4
8 mins
Section 7: Conclusion
20 Who cares?.mp4
5 mins
2 mins
Section 8: Supporting files
Comprehending comprehensions.pdf
1010 KB
6 KB
737 KB
Comprehending comprehensions.ipynb
69.7 KB


What if I dislike the course?

If you didn't get any value from the course, then just e-mail me ( and ask for a refund.

I'm a student or pensioner. Can I get a discount?

I know very well what it's like to be a student on a limited budget; I spend 11 years (!) on my PhD.  So yes, as with all of my products, there's a student discount.  E-mail me (, and I'll send you the appropriate coupon code.

And while I don't yet know what it's like to be a pensioner/retiree, I do understand that it can be similarly challenging. For that reason, I have the same offer: E-mail me, and I'll give you the same discount as I give to students.

This price is far too high for someone living in my country. Do you offer "parity pricing," or something like it, for people outside of the world's wealthiest countries?

Indeed, I do: If your country is not one of the 30 with the highest per-capita GDP (as indicated here, at, then e-mail me.  I'll send you a coupon for 40% off the price, which I believe (hope) makes it more affordable.

Note that this applies to people currently living in one of those non-wealthy countries; not to people originally from there.

I bought your previous "Functional programming in Python," a live recording from the summer of 2017. Do I have to pay for this course?

Not at all!  E-mail me, and I'll send you a coupon code for a free upgrade. My "forever free" policy applies to upgrades and updates to my courses.  This course covers about half of the topics in that "Functional programming" course, although it has more exercises and explanations about comprehensions — and is thus a free upgrade from it.

What if you update the course?

My "forever free" policy ensures that once you buy this course, you get any and all updates for free.  Forever.

What version of Python do you use?

This course uses Python 3.6, the most recent as of when I recorded it.  Just about everything should work the same in Python 2.7, if you're still using it — although the Jupyter notebook that I provide only works in 3.6.

Can I buy this course for my team at work?

The course, as sold here, is for individuals.  However, e-mail me (at if you want to make a group or team purchase, and I'll provide you with an appropriate discount code for each team member to use.

What if I have more questions?

Just e-mail me at, and I'll try to answer as quickly as possible.

Because better developers have better careers

Have a more satisfying, successful, and lucrative career, by becoming more fluent in Python, Git, and related technologies.