This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # List comprehension to create a list the numbers 1 to 20 squared. | |
| list_of_squares = [x**2 for x in range(1, 20)] | |
| # The above list comprehension is the same as this for-loop: | |
| list_of_squares = [] | |
| for x in range(1, 20): | |
| list_of_squares.append(x**2) |
NewerOlder