What is the output?
print(list(enumerate('ab', 1)))
- [(0, 'a'), (1, 'b')]
- [(1, 'a'), (2, 'b')]
- [('a', 1), ('b', 2)]
- [(1, 'b')]
The second argument sets the starting index, so counting begins at 1.
Play Problem Solving ▸
print(list(enumerate('ab', 1)))