+ 1
What is enumerate??
2 Answers
+ 3
enumerate usually means to pack an iterables items together with their index number.
https://code.sololearn.com/cz9NnT6uLcp8/?ref=app
+ 2
It will iterate through a list and it will make a tuple of each item with an index starting at zero by default
for example
lst = ['first', 'second', 'third']
print(list(enumerate(lst)))
The output will be list of tuples like this
[(0, 'first'), (1, 'second'), (2,'third')]
If you want to start insexing by one you can do it by a second argument like this
lst = ['first', 'second', 'third']
print(list(enumerate(lst, 1)))
This will give
[(1, 'first'), (2, 'second'), (3,'third')]