Single Choice Not Set

QWhat will be the output after the following statements?
x = ('Today', 'nice', 'day')
x[1] = 'not'
print(x)

ID: #4002 Python Errors and Exceptions Handling 422 views
Question Info
#4002Q ID
Not SetDifficulty
Python Errors and Exceptions HandlingTopic

Choose the Best Option

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

  • A TypeError
  • B ('Today', 'nice', 'day')
  • C SyntaxError
  • D ('Today', 'not', 'nice', 'day')
Correct Answer

Explanation

TypeError
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [90], in ()
      1 x = ('Today', 'nice', 'day')
----> 2 x[1] = 'not'
      3 print(x)

TypeError: 'tuple' object does not support item assignment
---------------------------------------------------------------------------

Share This Question

Challenge a friend or share with your study group.