-->tuple data type is exactly 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 'tuple'>
>>>t[0]=100
TypeError: 'tuple' object does not support item assignment
>>>t.append("siddu")
AttributeError: 'tuple' object has no attribute 'append'
>>>t.remove(10)
AttributeError: 'tuple' object has no attribute 'remove'
Note: tuple is the read only version of list
No comments:
Post a Comment
Thank you Very Much.For Given Comment