Loading...
Python

tuple data type

tuple data type is same same as list data type except that it is immutable i.e., we cannot change values. Tuple elements can be represented within parenthesis.

Example:
t=(10,20,30,40)
type(t)
<class ‘tuples’>
t[0]=100
TypeError:’tuple’ object does not support item assignment
>>>t.append(“Webnoid”)
AttributeError: ‘tuple’ order has no attribute ‘append’
>>>t.remove(10)
AttributeError: ‘tuple’ object has no attribute ‘remove’

 

Leave a Reply

Your email address will not be published. Required fields are marked *