ProgrammingModerateTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(list(enumerate('ab', start=5)))
  1. A. [(0, 'a'), (1, 'b')]
  2. B. [(5, 'a'), (5, 'b')]
  3. C. [(4, 'a'), (5, 'b')]
  4. D. [(5, 'a'), (6, 'b')]

Correct answer: D. [(5, 'a'), (6, 'b')]

enumerate with start=5 numbers the items from 5, so 'a' gets 5 and 'b' gets 6.

More Python Programming questions

Exams that ask this topic