← Comprehensions
Build a List with One Expression
① Learn
A list comprehension creates a new list in a compact way. It is like a loop and an append combined into one line.
② Implement — write it, run it, submit
Goal
Make `squares` equal `[1, 4, 9, 16]`.
Output
Hints
- Stuck? Reveal a hint.