REMOVE()
The remove() method deletes the first occurrence of a specified item from the list. You specify the value you want removed, and Python scans the list from left to right until it finds a match. If the value exists, it is removed; if it does not, Python raises a ValueError.
random = ['beetroot', 'horlicks', 'pineapple', 'peanuts', 'beetroot', 'horlicks', 'peanuts', 'apple']
userInput = input()
random.remove(userInput)
print(random)Last updated