Python Programming - Lambda Functions - Discussion

Discussion Forum : Lambda Functions - General Questions (Q.No. 52)
52.
In Python, how can a lambda function be used with the max() function to find the maximum length string in a list?
max(strings, key=lambda x: x)
max(strings, key=lambda x: len(x))
max(strings, lambda x: len(x))
max(strings, lambda x: x)
Answer: Option
Explanation:
The key parameter is used to specify the lambda function that calculates the length of each string.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.