title: How to access a variable defined inside a function, from outside that function
body: <p>I am stuck on using variables defined in a previous function in another function. For example, I have this code:</p>
  
  <pre><code>def get_two_nums():
      ...
      ...
      op = ...
      num1 = ...
      num2 = ...
      answer = ...
  
  def question():
      response = int(input("What is {} {} {}? ".format(num1, op, num2)))
      if response == answer:
          .....
  </code></pre>
  
  <p>How will I use the variables defined in the first function in the second function? Thank you in advance</p>