I want to check if a string contains all the keywords. I am using the Enthought Canopy distribution.
For example:
string = 'I like roses but not violets'
key_words = ['roses', 'violets', 'tulips']
I've read that the all
function would serve me well. When I use this function in the following way
if all( keys in string.lower().split() for keys in key_words):
print True
Then True
is returned.
I would expect False
to be returned since tulips
is not in string.lower().split()
.
How can I fix this?