Python Enumerate Function | Enumerate Function In Python

Published: 21 May 2020
on channel: Parag Dhawan
111
4

Python Enumerate Function | Enumerate Function In python
0:14 Example
list1 = [1,2,3,4]

for index,ele in enumerate(list1,10):
print(f"index is :{index} , element is :{ele}")

2:13 syntax:-
enumerate(iterable, start=0)

2:40 User-Defined Enumerate Function
def userenum(iterable, start = 0):
n = start
for i in iterable:
yield n,i
n += 1

name = "parag dhawan"

for i,e in userenum(name):
print(f"{i}:{e}", end = " ")


def userenumerate(sequence, start=0):
n = start
for elem in sequence:
yield n, elem
n += 1

Value Returned by Enumerate function

The enumerate() method adds counter to an iterable and returns it.
The returned object is a enumerate object.

t1 = (1, 1.5, "parag")

ret = enumerate(t1)

print(type(ret))

dir(ret)

ret.__next__()

for i in ret:
print(f"{i}", end = " ")

11:20 Storing result in list or tuple

t1 = (1, 1.5, "parag")

newlist = list(enumerate (t1))

newlist

newtuple = tuple(enumerate(t1,1000))

newtuple

for i in newlist:
print(i)
=============================================================================
Link for Tutorial Series
Jupyter Notebook Tutorial Series:-
   • How To Open Jupyter Notebook in Windows  
Python Tutorial Series:-
   • Introduction to Python | Python Appli...  
Python Assignments and Objective Questions:-
   • Objective Questions Python - 1  
Tech. Videos By Parag Dhawan;-
   • Template Matching Using OpenCV (Pytho...  
=============================================================================
Feel free to connect and ask your queries:-
Linkedin:-   / parag-dhawan  
Youtube:-    / paragdhawan  
Facebook Page:- http://fb.me/dhawanparag
Instagram: -   / paragdhawan  
Twitter:-   / dhawan_parag  
GitHub:- https://github.com/paragdhawan/
Facebook Profile:- https://www.facebook.com/profile.php?...
=============================================================================
Show your support by Subscribing to the channel:-
https://www.youtube.com/c/ParagDhawan...
=============================================================================
Link of Next video:-    • Python Built-in ascii() Function | Py...  
=============================================================================
#ParagDhawan
#PythonCrashCourse
#Python
#PythonTutorialForBeginners
#PythonForDataScience
#PythonProgramming
#PythonProgrammingLanguage
#PythonTutorial
#PythonCode
#Python3
=============================================================================
Note: Watch the video at a speed of 1.5


On this page of the site you can watch the video online Python Enumerate Function | Enumerate Function In Python with a duration of hours minute second in good quality, which was uploaded by the user Parag Dhawan 21 May 2020, share the link with friends and acquaintances, this video has already been watched 111 times on youtube and it was liked by 4 viewers. Enjoy your viewing!