All problems
EasyLists
List comprehension — squares
Build a list of squares of 1..10 using a single-line list comprehension.
- #comprehension
Sample input
1..10
Sample output
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
list-comprehension.py
Output
Press "Run code" to execute.
