LearnFrenzy
Sign in Take a free test

Tuples · Tuples MCQ · Question 1

Creating a one-item tuple Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 1 Back to Exercise

Which expression creates a tuple containing only the number 5?

  • A (5)
  • B tuple(5)
  • C [5]
  • D (5,) Correct
Correct Answer: Option D

The comma makes the tuple. (5) is just 5, tuple(5) is a TypeError (an int is not iterable), and [5] is a list.

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