If you don't know the index of the item you want to remove from a list, but you know the value - YES! - you can use the value to delete it from the list. Example:
list = ["BMW", "MERCEDES", "FORD"]
list.remove("BMW")
print(list)
Output:
["MERCEDES", "FORD"]
-------------------------Subscribe----------------------------
• If you like to see a variety of fun and interactive projects written in Python
• If you love ☕ and 🐶 WAIT! - Yeah! Definitely, coffee and dogs!
-----------------------------------------------------------------------
-------------------------Socials----------------------------
• Twitter: / iftodd1
• Facebook: / iftodd
• Instagram: / if_todd
------------------------------------------------------------------
-------------------------Support----------------------------
You can support me here: / if_todd
--------------------------------------------------------------------
How to remove items by value in a list? #lists #Python #shorts