ProgrammingHardWipro · Accenture · Capgemini pattern

What does the following Python 3 code print? print(list(enumerate(["a", "b", "c"], start=1)))

  1. A. [(0, 'a'), (1, 'b'), (2, 'c')]
  2. B. [('a', 1), ('b', 2), ('c', 3)]
  3. C. [(1, 'a'), (2, 'b'), (3, 'c')]
  4. D. [(1, 'a'), (2, 'b')]

Correct answer: C. [(1, 'a'), (2, 'b'), (3, 'c')]

The start=1 argument makes the index counter begin at 1 instead of the default 0.

More Python Programming questions

Exams that ask this topic