Manipulating Tuples
Manipulating Tuples
Tuples are immutable, hence if you want to add, remove or change tuple items, then first you must convert the tuple to a list. Then perform operation on that list and convert it back to tuple.
Example:
Output:
Thus, we convert the tuple to a list, manipulate items of the list using list methods, then convert list back to a tuple.
However, we can directly concatenate two tuples instead of converting them to list and back.
Example:
Output: