Python Programming - Lambda Functions - Discussion

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

Post your comments here:

Your comments will be displayed after verification.