Python: Deleting a Tuple

Tuples are immutable and cannot be deleted. Just like list we cannot delete the tuple by using the del keyword. But we can entirely delete the tuple by the use of del keyword.

tup = ('physics', 'chemistry','biology')
print(tup)

del tup
print(tup)

Output:

('physics', 'chemistry', 'biology')
NameError: name 'tup' is not defined.
Tags