title: "NameError: name 'response' is not defined when i try to use the variable in Python3
body: <pre><code>import sys
  
  def func2():
      print(&quot;1.Type a number &quot;)
      print(&quot;2.Exit the program &quot;)
      response = int(input())
  
  func2()
  
  def func1():
          print('Are you sure ? ') 
          print(&quot;Yes or No&quot;)
          response = input()
          if response == 'Yes':
              sys.exit()
          elif response == &quot;yes&quot;:
              sys.exit()
          else:
              func2()
  
  if response == 1:
      secondresponse = input(&quot;Print a number &quot;)
      print (&quot;You typed in &quot;+ secondresponse+ &quot;.&quot;)
  elif response == 2:
      func1()
  </code></pre>
  <p>Why does it give me the error NameError: name 'response' is not defined when I called the variable in the function. Or is that not allowed?</p>