Python Program to remove an element from a list ( Using discard() method)

bookmark

# Python program to remove an element from a list using discard() method  
my_list = [1, 2, 3, 4, 5]  
my_list.discard(3)  # Removes the element 3 from the list  
print(my_list)    


Output:

[1, 2, 4, 5]