In Python, Enumerate() function is an in-built function to keep a count of iterations. Enumerate() function return the enumerate object with adding a counter for each iteration. This enumerate function is used mostly in for loops to add the counter for each iteration
Here is an example of using enumerate() in for loop:
list1 = [‘read’, ‘code’, ‘practise’]
for ele in enumerate(list1):
print (ele)
Output:
(‘0’, ‘read’)
(‘1’, ‘code’)
(‘2’, ‘practice’)
If you are interested to learn Python from Industry experts, you can check out this Python Training course by Intellipaat.
You can watch this video on Python tutorial in Hindi by Intellipaat to get a quick start in Python.