I have a list of strings that are a few words long, and I need to search for two keywords, and return the strings that contain those two key words.
I have tried to loop through the strings, but was not able to do so. I tried the .find() function but that was not successful on a list of strings.
Lets say we have a list:
list = ["The man walked the dog", "The lady walked the dog","Dogs
are cool", "Cats are interesting creatures", "Cats and Dogs was an
interesting movie", "The man has a brown dog"]
I would like to iterate through the list of strings and return the strings in a new list that contain both the words "man" and "dog". Ideally, to get the following:
list_new = ["The man walked the dog", "The man has a brown dog"]