title: Unbound Local Error: local variable referenced before assignment inside of a try and except statement
body: <p>I am attempting to create a very simple menu system, using all of the pythonic tools, (try and except statements, loops, if statements) and I have run into a little bit of trouble.</p>
  
  <p>This is the code and error message i have at the moment</p>
  
  <pre><code>def Menu():
  while True:
      print("""
      Hello, please enter a number 1 - 4
          1 - Compliment
          2 - Fact
          3 - Insult
          4 - Quit
          """)
  
      try:
          UserInput_INT = int(input("&gt; "))
  
  
      except ValueError:
          UserInput_STR = (UserInput_INT)
          if len(UserInput_STR) == 0:
              print("You have entered nothing. Please enter a number between 1 and 4")
          print("You entered a character. Please enter a number between 1 and 4")
          Menu()
  
      if  UserInput_INT not in range (1, 5):
          print("Invalid input please enter a whole number between 1 and 4")
          continue
  
      UserInput_STR = (str(UserInput_INT))
      if UserInput_STR == '1':
          print(" You look horrible today!")
  
      elif UserInput_STR == '2':
          print("Sam Birkenshaw &amp; Jordan Ives can code better than Mr Bath. ")
  
      elif UserInput_STR == '3':
          print("You are bad at coding ")
  
      elif UserInput_STR == '4':
          quit()
  </code></pre>
  
  <p>Menu()</p>
  
  <p>error message:</p>
  
  <p>"Traceback (most recent call last):
    File "E:/All/School Work/Computer Science/Code/SAM broken code.py", line 12, in Menu
      UserInput_INT = int(input("> "))
  ValueError: invalid literal for int() with base 10: ''</p>
  
  <p>During handling of the above exception, another exception occurred:</p>
  
  <p>Traceback (most recent call last):
    File "E:/All/School Work/Computer Science/Code/SAM broken code.py", line 39, in 
      Menu()
    File "E:/All/School Work/Computer Science/Code/SAM broken code.py", line 16, in Menu
      UserInput_STR = (UserInput_INT)
  UnboundLocalError: local variable 'UserInput_INT' referenced before assignment"</p>
  
  <p>I need to have it so that if the user enters nothing, there is a different message displayed than if they enter a letter, and if they enter something other than one of the accepted answers.</p>
  
  <p>(I am runing python 3.6.2 currently)</p>