The remove()
method removes the first matching element (which is passed as an argument) from the list.
In this blog post, you will learn how to use the python list remove()
method.
Step 1: Create a list
my_list = [1, 2, 3, 4, 5]
Step 2: Remove from the list
my_list.remove(3)
Step 3: Print the list
print(my_list)
Output:
[1, 2, 4, 5]