Computer Science, asked by DanishKhan5542, 11 months ago

Can we remove individual tuple elements ?

Answers

Answered by shivimishra3843
4

Answer:

yes

Explanation:

As DSM said, tuples are immutable, but we know Lists are mutable. So if you change a tuple to a list, it will be mutable. Then you can delete the items by the condition, then after changing the type to a tuple again. ... if you test the type of the last tuplex, you will find it is a tuple.

Answered by orangesquirrel
0

No, we cannot directly remove individual tuple elements in Python as they are immutable.

However, there are two ways in which things can be modified to remove tuple elements.

1. Convert it into a list first-----> Remove the required item-----> Convert it again into a tuple.

2. Index slicing can be done to achieve the same.

Similar questions