zip() (Python)
zip() combines two or more sequences element by element, pairing the first items together, the second items together, and so on. It is handy for looping over several lists at once, and it stops at the end of the shortest one.
Python
Examples
Python
names = ["Ana", "Ben"]
ages = [30, 25]
for name, age in zip(names, ages):
print(name, age)Output:
Ana 30
Ben 25