List Remove() in python is used to remove first occurrence of value as shown below.

a=[‘apple’, ‘orange’, ‘pineapple’, ‘pineapple’, ‘mango’, ‘guavava’]

when we use remove in list it will remove only first occurrence of a value in this case pineapple not all object with same name.

a.remove(‘pineapple’)

Output: [‘apple’, ‘orange’, ‘pineapple’, ‘mango’, ‘guavava’]

How to use List.Remove() in Python:

How to remove element in list using list.remove
1.List remove

It will raise value error if value is not present in the list.

By SC

One thought on “List.Remove”

Leave a Reply

Your email address will not be published. Required fields are marked *