KnowledgeBoat Logo

Computer Science

Carefully read the given code fragments and figure out the errors that the code may produce.

t = ('a', 'b', 'c', 'd', 'e')   
t[0] = 'A'  

Python Tuples

2 Likes

Answer

Output
TypeError: 'tuple' object does not support item assignment  
Explanation

Tuple is a collection of ordered and unchangeable items as they are immutable. So once a tuple is created we can neither change nor add new values to it.

Answered By

2 Likes


Related Questions