Python: how to create a list comprehension?

Example:

numbers = [1, 2, 3, 4, 5]
List comprehensions offer a concise way to create lists in Python.

Solution:

squared_numbers = [x**2 for x in numbers]

Beginner's Guide to Python