Deviopath › Python

Square Every Number

Easy · Comprehensions

A list comprehension builds a new list in one line: [expression for item in items]. For example, [x + 1 for x in nums] adds 1 to every number.

Write a function squares(numbers) that returns a new list with every number squared.

Next: Keep Only Even Numbers