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:
It will raise value error if value is not present in the list.
[…] List.Remove: To remove first occurrence of a […]