5. Data Structures — Python 3.11.4 documentation

PHOTO EMBED

Sun Aug 13 2023 08:18:49 GMT+0000 (Coordinated Universal Time)

Saved by @devan3068

>>> squares = []
>>> for x in range(10):
...     squares.append(x**2)
...
>>> squares
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
content_copyCOPY

https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions