Python: List comprehension
A short, tested Python example for list comprehension. Copy it and adjust the names and paths for your project.
Python
squares = [x * x for x in range(10)]
evens = [x for x in range(20) if x % 2 == 0]
flat = [item for row in matrix for item in row]Find it in Zest
Search for “python list comprehension” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.