DEV Community

Kozo Oeda
Kozo Oeda

Posted on

Iterate multiple lists all at once

Use zip and for-loop
Example:

a = ["a", "b", "c"]
b = [1, 2, 3]

for e1, e2 in zip(a, b):
    print(e1, e2)             

Output:

a 1
b 2
c 3

Top comments (0)