How to use enumerate on a list to loop over indexes and values in Python

1 Answer

0 votes
lst = ["python", "c#", "c++", "java"]

for i, item in enumerate(lst):
    print(i, item)

'''
run:

0 python
1 c#
2 c++
3 java

'''

 



answered Sep 12, 2018 by avibootz
...