Enumerate with a Start Index in Python


Use enumerate and specify a starting index.

Source Code

names = ["Alice", "Bob", "Charlie"]
for index, name in enumerate(names, start=1):
    print(index, name)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments