enumerate

enumerate.py


for i, fruit in enumerate(['banana', 'apple', 'orange']):
    print(i, fruit)
0 banana
1 apple
2 orange

Is output

Recommended Posts

enumerate
python enumerate function
Enumerate spanning trees
[Python] Operation of enumerate