python set add delete code example
Example 1: remove element form set in python
list1 = {1,2,3,4}
list1.remove(4)
print(list)
# {1,2,3}
Example 2: remove an item from a set python
list.discard(item)
Example 3: delete and return element from set python
>>> s = set([1])
>>> print s.pop()
1
>>> print s
set([])
>>> print s.pop()
KeyError: pop from an empty set