HOME/Articles/

python code list comprehensions (snippet)

Article Outline

Python example 'python code list comprehensions'

python code list comprehensions

Python code example: python code list comprehensions


#Use list comprehensions

numbers = [1, 2, 3]
squares = [number**2 for number in numbers]
print(squares)

More Python: https://pythonprogramminglanguage.com