Write a program function to check if given words appear together in a list of sentence


Topic: Write a program function to check if given words appear together in a list of sentence

Solution

def check(sentence, words): 
    res = [all([k in s for k in words]) for s in sentence] 
    return [sentence[i] for i in range(0, len(res)) if res[i]]



List all Python Programs