Deleting a Tuple
As discussed above, we cannot change the elements in a tuple. That also means we cannot delete or remove items from a tuple.
But deleting a tuple entirely is possible using the keyword del.
n=(1,2,3,4,5)
print(n)
del n[1]
output:
error : TypeError: ‘tuple’ object doesn’t support item deletion
#But we can delete entire tuple
n=(1,2,3,4,5)
print(n)
del n
print(n)
output:
(1, 2, 3, 4, 5)
# NameError: name ‘n’ is not defined