Sobes.tech
Junior — Senior

Squaring list elements using lambda expression

livecode

Task condition

Given an array of numbers, for example nums = [1, 2, 3, 4, 5]. Using a lambda, write a one-liner that transforms each element into its square and returns a new list.

Example: Input: [1, 2, 3, 4, 5] Output: [1, 4, 9, 16, 25]