title: Python - Try/Except with sum function
body: <p>im new to python and im practicing so i am doing a sum function, and now i want to show a message error when entering something that is not a number i tried with <code>try/excpet</code> and it kind of worked but sometimes it dont, here is the code i have now:</p>
  
  <pre><code>def sum(num_1, num_2):
      sum_total = num_1 + num_2
      print('The answer is:',sum_total)
      return sum_total
  
  def app_sum():
      try:
          inp_1 = int(input('Number 1?: '))
      except ValueError:
          print('Invalid input, try again')
          app_sum()
  
      try:
          inp_2 = int(input('Number 2?: '))
      except ValueError:
          print('Invalid input, try again')
          app_sum()
  
      sum(inp_1,inp_2)
  
  app_sum()
  </code></pre>
  
  <p>And this is the output i have:</p>
  
  <pre><code>Number 1?: 1
  Number 2?: 2
  The answer is: 3
  
  Number 1?: A
  Invalid input, try again
  Number 1?: 1
  Number 2?: A
  Invalid input, try again
  Number 1?: 1
  Number 2?: 1
  The answer is: 2
  Traceback (most recent call last):
    File "suma.py", line 9, in app_sum
      inp_1 = int(input('Number 1?: '))
  ValueError: invalid literal for int() with base 10: 'A'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "suma.py", line 24, in &lt;module&gt;
      app_sum()
    File "suma.py", line 12, in app_sum
      app_sum()
    File "suma.py", line 20, in app_sum
      sum(inp_1,inp_2)
  UnboundLocalError: local variable 'inp_2' referenced before assignment
  </code></pre>