-1

I want to read over two (differently sized) arrays simultaneously in python. After some searching around I found how to read two same sized arrays simultaneously but not different sized ones.

For example:

ak = ["a", "b", "c"]
ab = ["d", "e", "f"]

for a, b in zip(ak, ab):
    print(f'{a} | {b}')

this outputs:
a|d
b|e
c|f

however if I were to do

ak = ["a", "b", "c"]
ab = ["d", "e", "f", "g"]

for a, b in zip(ak, ab):
    print(f'{a} | {b}') 

It would only output the same as what was outputted when "ab" had 3 elements. I would like for it to output

a|d
b|e
c|f
|g

0 Answers0