Google News
logo
Python Program to Delete a Tuple
Once a tuple is created, you cannot change its values or delete it entirely. However, you can delete the entire tuple object.

Here's a Python program to delete a tuple :
Program :
# create a tuple
my_tuple = ("apple", "banana", "cherry")

# delete the entire tuple
del my_tuple

# this will raise an error since the tuple no longer exists
print(my_tuple)


When you run this program, you will get the following error :

Output :
NameError: name 'my_tuple' is not defined
This error is raised because the `my_tuple` variable no longer exists after it has been deleted.