I am trying to change the value of a particular element of a tuple of tuples. Here is the code:
y=((2,2),(3,3))
y[1][1]=999
print('y: ',y)
TypeError: 'tuple' object does not support item assignment
I understand that Tuples are immutable objects. “Immutable” means you cannot change the values inside a tuple. You can only remove them.
I was wondering if there is a workaround? I cannot create a list of lists for y
because I am using y
as a key in a dictionary later.