enumerate python
#Enumerate in python
l1 = ['alu','noodles','vada-pav','bhindi']
for index, item in enumerate(l1):
if index %2 == 0:
print(f'jarvin get {item}')
enumerate python
#Enumerate in python
l1 = ['alu','noodles','vada-pav','bhindi']
for index, item in enumerate(l1):
if index %2 == 0:
print(f'jarvin get {item}')
for enumerate python
for key, value in enumerate(["p", "y", "t", "h", "o", "n"]):
print key, value
"""
0 p
1 y
2 t
3 h
4 o
5 n
"""
enumerate in Python
>>> def my_enumerate(sequence, start=0):
... n = start
... for elem in sequence:
... yield n, elem
... n += 1
...
enumerate in python
enumerate(iterable, start=0)
Parameters:
Iterable: any object that supports iteration
Start: the index value from which the counter is
to be started, by default it is 0
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us