Programming Language Python Tuple MCQ Question #3716
Single Choice Not Set

QWhat is the type of the following variable
aTuple = ("Orange")
print(type(aTuple))

ID: #3716 Python Tuple MCQ 351 views
Question Info
#3716Q ID
Not SetDifficulty
Python Tuple MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A list
  • B tuple
  • C array
  • D str
Correct Answer

Explanation

To create a tuple with a single item, you need to add a comma after the item. Otherwise, Python will not recognize the variable as a tuple, and it will treat it as a string type.

For example:

aTuple = ("Orange")
print(type(aTuple))

bTuple = ("Orange",)
print(type(bTuple))

Output



Share This Question

Challenge a friend or share with your study group.