Tuple is not changable : Tuple Immutable « Tuple « Python






Tuple is not changable


T = (1, 2, 3)
T[2] = 4             # error!
T = T[:2] + (4,)     # okay: (1, 2, 4)
print T
           
       

Related examples in the same category