What is list comprehension?
Sequences and slicing
Audio flashcard · 0:17Nortren·
What is list comprehension?
0:17
A list comprehension is a concise way to create a list by applying an expression to each element of an iterable, optionally filtered by a condition. The syntax is brackets containing expression for variable in iterable optionally followed by if condition. They are typically faster and more readable than equivalent for loops with append.
docs.python.org