remove-value
---
id: remove-value
title: Removing an Element with a Specific Value using remove() Function
description: How to use the remove() function to find and remove a specific value from a list.
tags:
- list
- remove function
- Python
- programming
sidebar_position: 9
isPublic: false
---
# Removing an Element with a Specific Value using remove() Function
The `remove()` function can be used to find and remove a specific value from a list. This function removes **only the first appearance** of the specified value in the list.
<br />
## How to Use remove()?
To remove a specific value from a list using the `remove()` function, pass the value to be removed as a parameter.
For example, in the code below, `colors.remove('Blue')` removes the element with the value 'Blue' from the list.
```python title="Example of remove() function"
colors = ['Red', 'Blue', 'Green', 'Blue']
colors.remove('Blue')
print("colors:", colors)
# colors: ['Red', 'Green', 'Blue']
Although the 'Blue'
appears twice in the colors
variable, the remove()
function only removes the first 'Blue'
element found.
If the value does not exist in the list, a ValueError
is raised.