top of page
Python Tuple
Tuples are immutable data type. They are ordered and indexed like list and allow duplicate values.
Change Tuple Elements
As tuples are immutable, we cannot change them but what we can do is, we can cast the tuple first to list then change the list as per our requirement then cast it back to tuple.
Add Tuple Elements
As tuples are immutable, we cannot add element in tuple but what we can do is, we can cast the tuple first to list then add element in the list then cast it back to tuple.
Delete Tuple Elements
As tuples are immutable, we cannot delete element in tuple but what we can do is, we can cast the tuple first to list then delete element in the list then cast it back to tuple.
del a
We can't change the tuple because tuple is immutable but we can delete the tuple.
Tuple Loop
count()
index()
Tuple Functions
bottom of page