15 mins

Comprehensions

In Python it's very common to build up new lists while looping over old lists. Partly this is because we don't mutate lists very often while looping over them.

Because we build up new lists from old ones so often, Python has a special syntax to help us with this very common operation: list comprehensions.

Want to watch/read screencasts as they're announced?
Profile picture of Trey

My name is Trey Hunner and I'm a Python trainer. Through Python Morsels I publish new Python screencasts every week and I also send out Python exercises.

If you'd like to get announcements for new Python screencasts, sign up for Python Morsels below. I promise I won't spam you (see my Privacy Policy).

✨ Sign Up For Python Morsels ✨