πŸ”₯ Welcome to my blog! Latest updates available now. Visit daily! πŸ”₯ πŸ”₯ Click Here for Latest Updates – Visit My Blog πŸ”₯
πŸ”₯ Latest Updates πŸ“Š GP Grade Finder πŸ“’ Government Services Info πŸ†• New Schemes Updates

tuple data type in Python


-->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

Quatation of the Day 22-03-2026