enumerate in python 3.9.1

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 

I am Mr. Sachin pagar the founder of Pythonslearning, a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

google ads

Pythonslearning protected By DMCA