My code will not delete the items if they exist in the list.
This is the list I am working with: [1, 2, 3, 4, 5, 6, 7, 8]
Run the function: remove_items_from_list(my_list, [1,5,6])
This is the OUTPUT I am expecting: [2, 3, 4, 7, 8]
But I am getting: [1, 2, 3, 4, 5, 6, 7, 8]
def remove_items_from_list(ordered_list, items_to_remove):
if [items_to_remove] in ordered_list :
ordered_list.remove([items_to_remove])
return ordered_list
These are my instructions: This function takes two arguments: a list, and a list of numbers to remove from the list. This function will then check if those items exist within that list, and if they exist, then they will be removed.