Answers for "python what does enumerate do"

4

python for enumerate loop

>>> values = ["a","b","c"]
>>> for count, value in enumerate(values):
...     print(count, value)
...
0 a
1 b
2 c
Posted by: Guest on December-23-2020
5

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}')
Posted by: Guest on September-03-2020
0

enumerate in Python

grocery = ['bread', 'milk', 'butter']

for item in enumerate(grocery):
  print(item)

print('n')
for count, item in enumerate(grocery):
  print(count, item)

print('n')
# changing default start value
for count, item in enumerate(grocery, 100):
  print(count, item)
Posted by: Guest on July-31-2021

Code answers related to "python what does enumerate do"

Python Answers by Framework

Browse Popular Code Answers by Language