Answers for "pytho3 for i, num enumerate (Nums)"

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
1

enumerate in python

list1 = ['1', '2', '3', '4']

for index, listElement in enumerate(list1): 
    #What enumerate does is, it gives you the index as well as the element in an iterable
    print(f'{listElement} is at index {index}') # This print statement is just for example output

# This code will give output : 
"""
1 is at index 0
2 is at index 1
3 is at index 2
4 is at index 3
"""
Posted by: Guest on November-25-2020

Python Answers by Framework

Browse Popular Code Answers by Language