Q:

Filter out sentences in a list that don't contain particular words

Let's say I have this list:
sentences = ['the cat slept', 'the dog jumped', 'the bird flew']

I want to filter out any sentences that contain terms from the following list:
terms = ['clock', 'dog']

I should get:
['the cat slept', 'the bird flew']

I tried this solution, but it doesn't work
empty = []
if any(x not in terms for x in sentences):
    empty.append(x)

What's the best way to tackle this?

A:

I'd go with a solution like this for readability rather than reducing to a one liner:
for sentence in sentences:
    if all(term not in sentence for term in terms):
        empty.append(sentence)

