Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How To Remove Elements From a Set using discard() function in python

# discard() function will not raise an error if the given value to remove
# does not exist within the set

mySet = {1, 2, 3}
mySet.discard(1)
print(mySet)

# Output:
# {2, 3}
Source by liu-111.medium.com #
 
PREVIOUS NEXT
Tagged: #How #To #Remove #Elements #From #Set #function #python
ADD COMMENT
Topic
Name
6+1 =