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
If you didn't have built-in filter or didn't want to use extra space and you need a linear solution...
filter
def remove_all(A, v): k = 0 n = len(A) for i in range(n): if A[i] != v: A[k] = A[i] k += 1 A = A[:k]