title: Python 3: Creating A Function For User Choice
body: <p>I am trying to create a piece of code in Python 3 which allows the user to choose between several options. I have tried this several ways but none of them seem the right method to do so.</p>
  
  <p>Example Attempt:</p>
  
  <pre><code>usr_input = input("Input: ")
  while (usr_input != '1') | (usr_input != '2'):
      if usr_input == '1':
          search()
      elif usr_input == '2':
          sys.exit()
  </code></pre>
  
  <p>The problem with this is that the script hangs after entering an incorrect command.</p>
  
  <p>Can anyone give me the correct way to do this?</p>