Last Updated: February 25, 2016
·
457
· simul14

Find index when you're inside a loop

alist = [5, 6 , 7, 8]
for i, value in enumerate(alist):
    print i, ': ', value


-> 0: 5
-> 1: 6
-> 2: 7
-> 3: 8