1>>> values = ["a","b","c"]
2>>> for count, value in enumerate(values):
3... print(count, value)
4...
50 a
61 b
72 c
8
1>>> for count, value in enumerate(values):
2... print(count, value)
3...
40 a
51 b
62 c
7
1for index,subj in enumerate(subjects):
2 print(index,subj) ## enumerate will fetch the index
3
40 Statistics
51 Artificial intelligence
62 Biology
73 Commerce
84 Science
95 Maths
1for index,char in enumerate("abcdef"):
2 print("{}-->{}".format(index,char))
3
40-->a
51-->b
62-->c
73-->d
84-->e
95-->f
1#Enumerate in python
2l1 = ['alu','noodles','vada-pav','bhindi']
3for index, item in enumerate(l1):
4 if index %2 == 0:
5 print(f'jarvin get {item}')
1animals = ["cat", "bird", "dog"]
2
3#enumerate (For Index, Element)
4for i, element in enumerate(animals,0):
5 print(i, element)
6
7for x in enumerate(animals):
8 print(x, "UNPACKED =", x[0], x[1])
9
10'''
110 cat
121 bird
132 dog
14(0, 'cat') UNPACKED = 0 cat
15(1, 'bird') UNPACKED = 1 bird
16(2, 'dog') UNPACKED = 2 dog
17'''