1>>> for count, value in enumerate(values):
2... print(count, value)
3...
40 a
51 b
62 c
7
1mydict = {1: 'a', 2: 'b'}
2for i, (k, v) in enumerate(mydict.items()):
3 print("index: {}, key: {}, value: {}".format(i, k, v))
4
5# which will print:
6# -----------------
7# index: 0, key: 1, value: a
8# index: 1, key: 2, value: b
1grocery = ['bread', 'milk', 'butter']
2
3for item in enumerate(grocery):
4 print(item)
5
6print('\n')
7for count, item in enumerate(grocery):
8 print(count, item)
9
10print('\n')
11# changing default start value
12for count, item in enumerate(grocery, 100):
13 print(count, item)