In python tuple is an immutable objects means it can not be changed, only we can create. Alike list tuple are a sequence but the difference is tuple use parentheses "()" where as list uses square brackets [ ] and list can be changed where as tuple cannot.

In tuples we can not update or change the value, as a reason I stated above it is because tuples are immutable means can't change or modifie but only can be updated if their are more then one tuple. Only we take portions of existing tuples to create a new tuples.
Tuple is fast: The size of an element is pre calculated in Elixir which makes the process of finding the size of an element in tuple faster then list. Also finding element by index is fast in tuple.
So in this short tutorial, I am showing you how you can Update tuple in Python
Below example, you can see that we have 2 tuples tuple1 and tuple2 so for updating tuple we created a variable named tuple3:
tuple1 = (10, 30.16);
tuple2 = ('abcd', 'xyzp);
#Now i have to create new tupples as follows:
tuple3 = tuple1+tuple2
print tuple3
Output:
(10, 30.16, 'abcd', 'xyzp')
0 Comment(s)