Python check if any part of string in list
<p>I have a list containing synonyms for the word 'Good' (this list here is shortened)</p>

<pre><code>good_synonym = ['Good','good','Well','well']
</code></pre>

<p>And the program asks how the user is feeling</p>

<pre><code>print = 'Hello, ' + name + ', How are you?'
status = raw_input('')
</code></pre>

<p>But sometimes, the user may respond to the question with "I am good" (or similar)</p>

<p>If the answer contains a word in the good synonym list, I want the program to reply</p>

<pre><code>if status contains a word in good_synonym:
    print ('That is good')
else:
    print ('That is not so good')
</code></pre>

<h1>note that the first line is not real python language</h1>

<p>But I don't know which phrase to use to do the action.</p>

<p>There are many ways you could try to do this. Since you are a beginner, let's just go for something that will work - efficiency should NOT be your first consideration.</p>

<pre><code>status = status.split() # breaks response into words
if any(s in good_synonyms for s in status):
    print('That is good')
</code></pre>

<p>Of course it won't stop your program from acting as though "not good" is a reply deserving a happy answer, but this is a programming site.</p>

python