The zip() Function for Parallel Iteration in Python


Iterate over two or more sequences in parallel.

Source Code

names = ["Alice", "Bob", "Charlie"]
scores = [85, 90, 88]
for name, score in zip(names, scores):
    print(f"{name}: {score}")
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments