How do I check if a sentence contains a certain word in Python and then perform an action?

Viewed 80955

Let's say that I ask a user for raw input and they said, "This is a message." If that raw input contained the word "message" it would perform an action after that. Could I see how this can be done?

4 Answers
def findDog(st):
    return 'dog' in st.lower().split()
findDog('Is there a dog here?')
Related