List comprehensions

Let's look at list comprehensions

We'll cover the following...

List comprehensions in Python are very handy. They can also be a little hard to understand when and why you would use them. List comprehensions tend to be harder to read than just using a simple for loop as well. You may want to review the looping chapter before you continue.

If you are ready, then we’ll spend some time looking at how to construct list comprehensions and learn how they can be used. A list ...