MCQ Single Best Answer Not Set

QWhat is the output of the following code
aTuple = (100, 200, 300, 400, 500)
aTuple[1] = 800
print(aTuple)

ID: #3718 Python Tuple MCQ 326 views
Question Info
#3718Q ID
Not SetDifficulty
Python Tuple MCQTopic

Choose the Best Option

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

  • A TypeError
  • B (100, 800, 200, 300, 400, 500)
  • C (800, 100, 200, 300, 400, 500)
Correct Answer: Option A

Explanation

A tuple is immutable. Once a tuple is created, you cannot change its values. If you try to change its value, you will receive a TypeError: 'tuple' object does not support item assignment

Share This Question

Challenge a friend or share with your study group.