Answers for "discard method in python"

0

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]
Posted by: Guest on August-05-2021

Python Answers by Framework

Browse Popular Code Answers by Language