ProgrammingHardTCS NQT · Infosys pattern

What is printed?

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

Correct answer: B. [(5, 'a'), (6, 'b'), (7, 'c')]

The start argument changes only the first counter value that pairs with each element, starting at 5 instead of the default 0: (5,'a'), (6,'b'), (7,'c').

More Python Programming questions

Exams that ask this topic