The zip Function in Python


Combine elements from two or more iterables (lists, tuples, etc.) into pairs.

Source Code

names = ["Alice", "Bob", "Charlie"]
ages = [24, 30, 18]
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