Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

discard method in python

# the discard method removes the element from the set (a list or somthing else
# as long as its mutable) only if it is found in it.
list_a = [10, 30, 78, 10, 82, 66, 10]
print(list_a.discard(10))
# output: list_a = [30, 78, 82, 66]
 
PREVIOUS NEXT
Tagged: #discard #method #python
ADD COMMENT
Topic
Name
2+7 =