List comprehensions

Populate a list with a for loop : We can do that in only one line with a list comprehension ! Now a list comprehension with range() : List comprehensions : Collapse for loops for building lists into a single line Components : iterable iterator variable (represent members of iterable) Read more…