title: Creating a python program that guesses a user's "secret number"?
body: <p>I'm creating a program that asks you to think of a number from <code>0 to 100</code>. Then it will guess if it IS <code>50, lower than 50, or higher than 50</code>. The program will keep guessing with different numbers until it guesses the correct number.</p>
  
  <p>If the user doesn't enter <code>yes</code>, <code>lower</code> or <code>higher</code>, then the output is supposed to be <em>"I did not understand"</em>. The problem with my code is that it gets an infinite loop. I assume there is a loop and I need to include something to end it once the user says "yes". </p>
  
  <p>Here is what I have so far (I'm a novice programmer so I'm sorry if this doesn't make sense or if my code is really bad!):</p>
  
  <pre><code>print('Hello.')
  print('Pick a secret number between 0 and 100.')
  print('Is your secret number 50')
  low = 0
  high = 101
  guess = 50
  a = input('Enter yes/higher/lower:\n')
  while True:
      if a == 'yes':
          print('Great!')
          break
      elif a == 'lower':
          high = guess
          guess1 = (guess-low)//2+low
          print('Next is', guess1)
          print('Is your secret number', guess1)
      elif a == 'higher':
          low = guess
          guess1 = (high-guess)//2+guess
          print('Next is', guess1)
          print('Is your secret number', guess1)
      elif a != 'yes' or 'higher' or 'lower':
          print('I did not understand')
  </code></pre>