Definition
The discard() method removes the specified item from the set. This method does not return an error if the specified item does not exist.
Syntax
set.discard(value)
Parameters
Parameter | Description |
---|---|
value | Required. The item to search for, and remove |
Examples:
persons = {"Mark", "Jeff", "Ivan", "Mike"}
persons.discard("Mark")
print(persons)