How to use count() with list in for loop to produce a number for each item in Python

1 Answer

0 votes
from itertools import *     

for i in zip(count(1), ['a', 'b', 'c', 'd', 'e']):         
    print(i)
     
     
 
   
'''
run:
 
(1, 'a')
(2, 'b')
(3, 'c')
(4, 'd')
(5, 'e')

'''

 



answered May 21, 2019 by avibootz
...