In Python remove() will remove the first occurrence of value in a list.
How to remove all occurrences of a value from a list, without sorting the list?
This is what I have in mind.
>>> x = [1, 2, 3, 4, 2, 2, 3]
>>> def remove_values_from_list(the_list, val):
while val in the_list:
>>> remove_values_from_list(x, 2)
[1, 3, 4, 3]
© 2016 Powered by mzan.com design MATCHINFO