Simple squaring
Input
square_each([1, 2, 3])
Output
[1, 4, 9]
Each element is squared: 1->1, 2->4, 3->9.
Full lesson preview
Return a list where each number from the input has been squared.
Problem statement
Task
Examples
Input
square_each([1, 2, 3])
Output
[1, 4, 9]
Each element is squared: 1->1, 2->4, 3->9.
Input format
Output format
Constraints
Samples
Input
square_each([-1, 0, 5])
Output
[1, 0, 25]
Squares: (-1)^2=1, 0^2=0, 5^2=25.