How to recode line so an exact sentence must be in the list for it to match
<pre><code>x = ["Cookie flavored water is yummy 6", "Coding complicated 16", "Help 7"]

for i in x:
    if "flavored" in x:
        print ("Yes")
    else:
        print ("No")
</code></pre>

<p>I want the exact string "Cookie flavored water is yummy" to be in the list for it to be acceptable but I don't want the 6 part included. I'm completely befuddled on how to accomplish this. Also the objective might change from the first element to a different element.</p>

<p>What do you mean by "acceptable?" Additionally, when you say you don't want the number at the end of the items in the list to be included, do you mean for your comparison? I agree with the other answers, and if you happen to want to remove the numbers from the list:</p>

<pre><code>x = [' '.join(i.split(' ')[:-1]) for i in x]
</code></pre>

python list