Python Programming - Lambda Functions - Discussion

Discussion Forum : Lambda Functions - General Questions (Q.No. 27)
27.
What is the output of the following code?
numbers = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x**2, numbers))
print(squared)
[1, 2, 3, 4, 5]
[1, 4, 9, 16, 25]
[2, 4, 6, 8, 10]
[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
Answer: Option
Explanation:
The map() function applies the lambda function to each element of the list, squaring each number.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.