Skip to main content
Python Output Prediction Medium +20 XP

Zip Function

What does this produce?

PythonRead-only
names = ["Alice", "Bob"]
ages = [25, 30]
print(list(zip(names, ages)))

What is the output?

Show answer and explanation

Answer: [("Alice", 25), ("Bob", 30)]

zip pairs elements from multiple iterables into tuples.

Hint: zip pairs corresponding elements.

What this challenge tests

Output Prediction in Python: zip, iterables.

Related challenges