Method signature:
discard(element_in)
Method Overview:
- The discard() method removes an element from a Python set if the element is present in the set.
- Unlike the remove() method of the set class, the discard() method does not raise a KeyException if the element is not found.
Parameters:
element_in : The element that is to be removed from a Python set.
Example:
# Example Python program that removes an element from a set |
Output:
{'Electric car', 'Hydrogen car'} |