I have two lists:
list1=[1,2,3]
list2=[4,5,6,7]
And I want to iterate over them. What I want to obtain is something similar to this:
1,4
2,5
3,6
,7
I have thought of using the zip
function but it doesn't seem to work with different length lists as by using the following code:
for l1, l2 in list1, list2:
print(l1,l2)
I get this:
1,4
2,5
3,6
So the number 7 is missing. I wonder how could I adapt the code or if there is any other option I am missing to iterate in parallel when the lists are of different lengths?