title: How to check if input/raw_input contains an item in a list. Python code
body: <pre><code>name = input(str('Please enter your name'))
  names= ('name1','name2','nameetc')
  if name in names:
      print "hi",name
  </code></pre>
  
  <p>If I use this code and user inputs <code>name1</code>, I get an error <code>name1 is not defined</code>. If the user puts <code>"name1"</code> in quotes then it works. I could ask the user to put the name in quotes, but then how do I check to ensure that it was before continuing. Preferably I would only have to ask for the name though. If I replace each <code>str</code> in the list with an int the code works fine. How do I make it work with a <code>str</code> in a list?</p>