ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(max(len(w) for w in 'the quick brown fox'.split()), [w for w in 'the quick brown fox'.split() if len(w) == 5])
  1. A. 5 ['quick']
  2. B. 5 ['quick', 'brown']
  3. C. 4 ['quick', 'brown']
  4. D. 5 ['brown', 'quick']

Correct answer: B. 5 ['quick', 'brown']

The longest word has five letters, and both quick and brown have five letters. The list keeps them in their original order.

More Python Programming questions

Exams that ask this topic