Iterating through user input and a list
<p>I need to match user input to some keywords held in a list.</p>

<p>I have tried several ways to do this, using for, if and while.  Even thought enumerate would be best but cant seem to put it together.  I need to take into account the user may input several words. Eventually the code will be related to something else and open files related to the keywords.</p>

<p>Sample code:</p>

<pre><code>shopping = [
    'bananas',
    'apples',
    'chocolate',
    'coffee',
    'bread',
    'eggs',
    'vimto'
    ]

need = input ("please input what you need ")
need = need.lower()
need = need.split()
index = 0
while index &lt; len(shopping):
    for word in need:
        if word == shopping[index]:
            print ("Added to basket")
            index +=1

        if word != shopping[index]:
            index +=1
</code></pre>

<p>I also need the code to print a response if the input doesn't match a keyword. At the moment the keyword is found, but if the user inputs anything after the keyword, errors occur.</p>