How do you check if the words exist in the sentence in Python?
So far I have got... the_sentence = ("I love chocolate and chocolate loves me")
sentence = the_sentence.split() print(sentence) sentence_1 = raw_input("Enter a word") def "word": if word in the_sentence: print "Yes" elif word not in the_sentence: print "Nope" Thanks
So far I have got... the_sentence = ("I love chocolate and chocolate loves me")
sentence = the_sentence.split() print(sentence) sentence_1 = raw_input("Enter a word") def "word": if word in the_sentence: print "Yes" elif word not in the_sentence: print "Nope" Thanks