Table of Contents
show
Introduction:
- Tuples are immutable
- The values or items in the tuple cannot be changed once it is declared.
- To change the values in the tuple, one have to create a new tuple
Example:
#create a tuple
>>> a=(4,6,2,4)
>>> a
(4, 6, 2, 4)
#change the value at 2nd postion
>>> a[2] = 100
TypeError: 'tuple' object does not support item assignment
Views: 2