Python Programming - Lambda Functions - Discussion

Discussion Forum : Lambda Functions - General Questions (Q.No. 63)
63.
What is the result of the following code?
items = ['apple', 'banana', 'cherry']
lengths = list(map(lambda x: len(x), items))
print(lengths)
[5, 6, 6]
[3, 6, 6]
[1, 1, 1]
['apple', 'banana', 'cherry']
Answer: Option
Explanation:
The map() function applies the lambda function to get the length of each string in the list.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.