In Python remove() will remove the first occurrence of value in a list.
remove()
How to remove all occurrences of a value from a list?
This is w
I just did this for a list. I am just a beginner. A slightly more advanced programmer can surely write a function like this.
for i in range(len(spam)): spam.remove('cat') if 'cat' not in spam: print('All instances of ' + 'cat ' + 'have been removed') break