remove an item from a set python code example
Example 1: remove an item from a set python
# it doesn't raise error if element doesn't exits in set
thisset = {1, 2,3}
thisset.discard(3)
print(thisset)
Example 2: remove element form set in python
list1 = {1,2,3,4}
list1.remove(4)
print(list)
# {1,2,3}
Example 3: remove an item from a set python
list.discard(item)
Example 4: remove an element from a set
list.remove(element)