remove multiple occurrences of same element
Title
Question
How to remove multiple occurrences of same elements at single step?
Python-3.4.3 Getting-started-with-Lists 00-01 min 0-10 sec
Answers:
You can remove multiple occurrences from a list with list comprehension
def remove_values_from_list(the_list, val):
return [value for value in the_list if value != val]
Login to add comment