How to loop through three lists in parallel with Python

1 Answer

0 votes
import itertools

lstid = [1, 2, 3, 4]
lstname = ["Fox", "Neo", "Kaylee"]
lstage = [55 ,36, 97]

for a, b, c in itertools.zip_longest(lstid, lstname, lstage, fillvalue = 0):
    print(a, b, c)







'''
run:

1 Fox 55
2 Neo 36
3 Kaylee 97
4 0 0

'''

 



answered Apr 20, 2021 by avibootz

Related questions

...