Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (55.6k points)

Can anyone explain the enumerate in Python?

1 Answer

0 votes
by (119k points)

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.

Browse Categories

...