The zip() Function for Parallel Iteration in Python


Iterate over two or more lists in parallel.

Source Code

names = ["John", "Jane", "Jake"]
ages = [23, 34, 45]
for name, age in zip(names, ages):
    print(f"{name} is {age} years old")
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments