enumerate in python 3.9.1

Spread the love

In python we deal with many iterators, ex list, we need to keep count of count of objects along with
their indices, for this we use enumerate().

enumerate in python
enumerate in python

python code for enumerate in python 3.9.1

sach = ['python','java','c','c#']
en = enumerate(sach)
[(0,'python'), (1,'java'), (2,'c'), (3,'c#')]

We can see it returns tuples of index value with the item at that particular index.
This method can be used with any of the objects on which we can iterate.
Also this method is so wildly used in loops like,
s = [‘python’,’java’,’c’,’c#’]
for count,element in enumerate(s):
here count has the index value and element has the actual element.

Summary :

In this section we are see enumerate in python 3.9.1 so about this section you have any query then free to ask me

Name of Intern who share this Task:

swapnil raj 

sachin Pagar

I am Mr. Sachin pagar Embedded software engineer, the founder of Sach Educational Support(Pythonslearning), a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Leave a Reply