List comprehension in Python
Sooraj Parakkattil
Jun 21, 2020·3 min read
Common applications are to make new lists where each element is the result of some operations applied to each member of another sequence or iterable or to create a subsequence of those elements that satisfy a certain condition.
- List comprehension is an elegant way to define and create lists based on existing lists.
- List comprehension is generally more compact and faster than normal