zip()
Combines multiple iterables into an iterator of tuples, stopping at the shortest.
Syntax
python
zip(*iterables)Example
python
names = ["Alice", "Bob"]
scores = [95, 87]
for name, score in zip(names, scores):
print(f"{name}: {score}")Combines multiple iterables into an iterator of tuples, stopping at the shortest.
zip(*iterables)names = ["Alice", "Bob"]
scores = [95, 87]
for name, score in zip(names, scores):
print(f"{name}: {score}")