I need to build a function that takes a list and removes every item that doesn't meet all the criteria's I've specified.
The structure is the following :
def function(my_list):
for element in my_list:
if not criteria_1:
my_list.remove(element)
else:
if not criteria_2:
my_list.remove(element)
return my_list
- The issue is that the list I get as a result contains elements that don't match the criteria's
- The expected output is a list that contains only elements that match all the criteria's.