What is the output of print(len(max(['a', 'abc', 'ab'], key=len))) in Python?
print(len(max(['a', 'abc', 'ab'], key=len)))
Correct answer
B. 3
6 views
B. 3
6 views
max with key=len picks the longest item.
Asked in: Python Interview Lists
https://docs.python.org/3/tutorial/datastructures.htmlNot sure why the answer is B? Ask here and get an explanation.