I have a list of strings that i would like to search for a word combination. Then delete the list if the combination is not there. Is there a python list comprehension that would work?
word_list = ["Dogs love ice cream", "Cats love balls", "Ice cream", "ice cream is good with pizza", "cats hate ice cream"]
keep_words = ["Dogs", "Cats"]
Delete_word = ["ice cream"]
Delete words that have ice cream in it but if dogs or cats is in the sentence keep it.
Desired_output = ["Dogs love ice cream", "Cats love balls", "cats hate ice cream"]
Was trying this code also tried AND and OR but cannot get the combination right.
output_list = [x for x in word_list if "ice cream" not in x]