Glossary · Python
What is List Comprehension?
A one-line way to build a list from another sequence, optionally with a condition.
In more detail
Readable for short transformations and filters; use a normal loop when logic gets complicated.
Example
[m for m in marks if m >= 75]
Learn it properlyPython Lists and Dictionaries: The Two Structures You Will Use Every Day12 min lesson · Python