LearnFrenzy
Sign in Take a free test

Tuples · Predict the Output · Question 2

Packing and unpacking Answer, explanation & discussion

  • Output
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

What is the output of the following Python program?

main.py
t = 1, 2, 3
a, b, c = t
print(t, a + c)
  • A 1 2 3 4
  • B (1, 2, 3) 4 Correct
  • C [1, 2, 3] 4
  • D (1, 2, 3) 13
Correct Answer: Option B

1, 2, 3 packs a tuple; unpacking gives a = 1, c = 3.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links