<jupyter_start><jupyter_text>All the IPython Notebooks in this lecture series by Dr. <NAME> are available @ **[GitHub](https://github.com/milaan9/02_Python_Datatypes/tree/main/003_Python_List_Methods)**  Python List `remove()`The list **`remove()`** method removes the first matching element (which is passed as an argument) from the list.**Syntax**:```pythonlist.remove(element)```  `remove()` Parameters* The **`remove()`** method takes a single element as an argument and removes it from the list.* If the **`element`** doesn't exist, it throws **ValueError: list.remove(x): x not in list exception**.  Return Value from `remove()`The **`remove()`** doesn't return any value (returns **`None`**).<jupyter_code># Example 1: Remove element from the list

# animals list
animals = ['cat', 'dog', 'rabbit', 'guinea pig']

# 'rabbit' is removed
animals.remove('rabbit')

# Updated animals List
print('Updated animals list: ', animals)
# Example 2: remove() method on a list having duplicate elements

# If a list contains duplicate elements, the remove() method only removes 
# the first matching element.

# animals list
animals = ['cat', 'dog', 'dog', 'guinea pig', 'dog']

# 'dog' is removed
animals.remove('dog')

# Updated animals list
print('Updated animals list: ', animals)<jupyter_output>Updated animals list:  ['cat', 'dog', 'guinea pig', 'dog']<jupyter_text>Here, only the first occurrence of element **`'dog'`** is removed from the list.<jupyter_code># Example 3: Deleting element that doesn't exist

# animals list
animals = ['cat', 'dog', 'rabbit', 'guinea pig']

# Deleting 'fish' element
animals.remove('fish')

# Updated animals List
print('Updated animals list: ', animals)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup