title: Python loop restarting even though there is a try: except:
body: <p>Here is the code for a small program I just wrote to test some new things I learned.</p>
  
  <pre><code>while 1:
      try:
          a = input("How old are you? ")
      except:
          print "Your answer must be a number!"
          continue
  
      years_100 = 100 - a
      years_100 = str(years_100)
      a = str(a)
      print "You said you were "+a+", so that means you still have "+years_100+" years"
      print "to go until you are 100!"
      break
  while 2:
      try:
          b = str(raw_input('Do you want to do it again? If yes enter "yes", otherwise type "no" to stop the script.'))
      except:
          print 'Please try again. Enter "yes" to do it again, or "no" to stop.'
          continue
  
      if b == "yes":
              print 'You entered "yes". Script will now restart... '
      elif b == "no":
              print 'You entered "no". Script will now stop.' 
              break
  </code></pre>
  
  <p>It works fine for the for loop. If you type something other than a number, it will tell you only numbers are allowed.</p>
  
  <p>However, in the 2nd loop, it asks you to enter yes or no, but if you enter in something different, it just restarts the loop instead of printing the message after</p>
  
  <pre><code>except:
  </code></pre>
  
  <p>What did I do wrong and how do I fix it so it displays the message I told it to?</p>