ProgrammingHardTCS NQT · Accenture

What is printed?

What is printed?
print(max(map(len, ['aa', 'b', 'ccc'])))
  1. A. 2
  2. B. 1
  3. C. 6
  4. D. 3

Correct answer: D. 3

map applies len to each string, giving 2, 1 and 3, and max returns the largest length.

More Python Programming questions

Exams that ask this topic