The discard() method also removes an element from the set like remove().
This method does not raise any exception if an attempt is made to discard an element that does not exist.
Example:
my_set = {1, 2, 3, 4, 5}
# Discard an existing element
my_set.discard(3)
print(my_set) # Output: {1, 2, 4, 5}
# Discard a non-existing element (no error, set remains unchanged)
my_set.discard(6)
print(my_set) # Output: {1, 2, 4, 5}