1items=['baseball','basketball','football']
2for index, item in enumerate(items):
3 print(index, item)
1>>> values = ["a","b","c"]
2>>> for count, value in enumerate(values):
3... print(count, value)
4...
50 a
61 b
72 c
8
1for idx, item in enumerate(list):
2 print(item)
3 print('Iteration number: ', idx)
1# The pythonic way to find the count in a for-in loop (by using 'enumerate')
2
3#count=0
4for idx, item in enumerate(list):
5 print item
6 #count +=1
7 #if count % 10 == 0:
8 if (idx+1) % 10 == 0:
9 print 'did ten'
10
1array = ["Var1","Var2","Var3"]
2for i in range(len(array)):
3 print(array[i])
4
5#Output#
6#Var1
7#Var2
8#Var3