Predict Tuple Packing and Unpacking
Predict Output Easy
Question
What does this code print?
Code
t = 10, 20, 30
a, b, c = t
print(b)
print(a + c)
Hint
Tuple packing creates a tuple; unpacking assigns to variables.
Explanation
t = 10, 20, 30 packs into a tuple. a, b, c = t unpacks: a=10, b=20, c=30. print(b) outputs 20. print(a + c) outputs 10 + 30 = 40.
Related Resources
Related Lessons
- Tuples
Packing and unpacking.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.