Convert to FP

Report a typo

Consider the following Python code:

numbers = [1, 2, 3, 4, 5]

# square each number in the list
for i in range(len(numbers)):
    numbers[i] = numbers[i] ** 2

# print the squared numbers
for num in numbers:
    print(num)

How can this code be transformed into a functional program?

Select one or more options from the list
___

Create a free account to access the full topic