CBSE Class 12 Computer Science Question 81 of 105

Python Revision Tour II — Question 8

Back to all questions
8
Question

Question 5(a)

Find the errors. State reasons.

t = (1, "a", 9.2)
t[0] = 6
Answer

t[0] = 6 will raise a TypeError as tuples are immutable (i.e., their elements cannot be changed after creation).