title: Is there a way to hide a correct Name Error message?
body: <p>I'm working on writing a simple function that will take the square root of a number. The user is prompted to provide a integer. However, if they provide a string--I'd like there to be a message "You did not give me a number".  </p>
  
  <p>See code below: </p>
  
  <pre><code>def square(n):
      """Takes a square root of a number :rtype : int """
      if n == int(n):
          return pow(n, 2)
  
  try:
      answer = int(input("...."))
  except ValueError:
      print("You did not give me a number!")
  
  final_answer = "{} squared is {}".format(answer, square(answer))
  print(final_answer)
  </code></pre>
  
  <p>Works okay with a integer: </p>
  
  <pre><code>....9
  9 squared is 81
  </code></pre>
  
  <p>With a string: </p>
  
  <pre><code>Traceback (most recent call last):
  File , line 28, in &lt;module&gt;
  final_answer = "{} squared is {}".format(answer, square(answer))
  NameError: name 'answer' is not defined
  
  You did not give me a number!
  </code></pre>
  
  <p>The error makes perfect sense since answer isn't defined. However, is there a way to just print/return the exception "You did not give me a number" without the NameError message?</p>
  
  <p>Thank you for you help! </p>