# create a set
my_set = {1, 2, 3, 4, 5}
# delete the set
del my_set
# check if the set exists
try:
print(my_set)
except NameError:
print("The set does not exist.")
The set does not exist.
my_set
` and then deletes it using the `del
` keyword. Finally, it checks if the set exists by attempting to print it, and catches the resulting `NameError
` to confirm that the set has been deleted.