LearnFrenzy
Sign in Take a free test

Tuples · Find the Error · Question 7

Error: adding an int to a tuple Answer, explanation & discussion

  • Find the error
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 7 Back to Exercise

The program below stops with an error. Which statement correctly describes the problem?

main.py
scores = (72, 85)
scores = scores + 91
print(scores)
  • A It prints (72, 85, 91)
  • B It prints (163, 176)
  • C TypeError: a tuple can only be concatenated with another tuple; write scores + (91,) Correct
  • D AttributeError
Correct Answer: Option C

Wrap the new item in a one-item tuple.

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