Answers for "how to use counter in for loop in python"

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
0

python for loop get iteration number

for idx, item in enumerate(list):
    print(item)
    print('Iteration number: ', idx)
Posted by: Guest on September-09-2020

Code answers related to "how to use counter in for loop in python"

Python Answers by Framework

Browse Popular Code Answers by Language