Google News
logo
Python Program to Remove an item
Here's an example program that demonstrates how to remove an item from a list in Python :
Program :
# create a list
my_list = ["apple", "banana", "cherry"]

# remove "banana" from the list
my_list.remove("banana")

# print the updated list
print(my_list)
Output :
['apple', 'cherry']
In the above program, we first create a list containing three items: "apple", "banana", and "cherry". We then call the `remove()` method on the list to remove the second item, which is "banana". Finally, we print the updated list to verify that the item has been removed.