In this lesson, you saw the benefit of what we did in the previous lessons where we broke the list comprehensions down and transformed them into traditional for
loops. Doing this helped to make it easier to grasp them.
You also saw a generalized pattern for writing for
loops with filtering:
values = [expression for value in collection if condition]
values = []
for value in collection:
if condition:
values.append(expression)