Can we remove individual tuple elements ?
Answers
Answered by
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
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
Physics,
5 months ago
English,
5 months ago
English,
5 months ago
Computer Science,
11 months ago
Computer Science,
11 months ago
Science,
1 year ago