How we update and delete tuples ?
Answers
Answered by
0
We cannot update or delete tuples as they are immutable.
- In python, tuples are sequences which are quite similar to lists.
- Tuples can be easily created by adding values separated by commas.
- The values of tuples cannot be changed unlike lists but certain portions can be taken to create new ones.
They can be converted to lists in order to make changes:
1) Convertion to list using built-in function
list( ).
2) A new value is assigned to the element at a certain index.
3) Another built-in function- tuple( ) is used to convert the list object back to tuple.
- A different method can be adopted to delete tuples which is Slice notation but it creates problems.
Similar questions