title: How should I pass variables between functions in this class?
body: <p>What I'm trying to do:
  executing the script, I will have to type in two numbers and it will compare them. 
  I want to be asked a total of 3 times.
  The first time I will type in 10 and 5, second time 5 and 10 and the third time I will type in 10 and 10 to get all three possible answers.</p>
  
  <p>My problem with the first code is: <code>getnumbers()</code> is being called inside of <code>Checknumbers()</code>.
  I want to create functions and a loop and strictly ONLY execute the functions inside a dedicated loop and not within another function.</p>
  
  <p>I want everything clean cut and no reference of any function inside another function, I don't want to use any global variables either.</p>
  
  <p>I solved this with a class but I'm not really sure if I'm butchering the language or if this is common practice. Also I have to reference the class inside the <code>checknumbers()</code> function.</p>
  
  <p>First solution:</p>
  
  <pre><code>def getnumbers():
      x = input("Enter the X number: ")
      y = input("Enter the Y number: ")
      return x, y
  
  def checknumbers():
      x, y=getnumbers()
      if   x &gt; y:
          print(f'x is larger then y: x is {x} and y is {y}')
      elif y &gt; x:
          print(f"y is larger then x: x is {x} and y is {y}")
      elif y == x:
          print(f"x is equal to y: x is {x} and y is {y}")     
      else:
          print("Dont know mate")
  
  
  n = 0
  while(n &lt; 3):
      checknumbers()
      n += 1
  </code></pre>
  
  <p>This is the variant with the class:</p>
  
  <pre><code>class ui:
      x = input("Enter the X number: ")
      y = input("Enter the Y number: ")
  
  
  def checknumbers():
      if   ui.x &gt; ui.y:    
          print(f'x is larger then y: x is {ui.x} and y is {ui.y}')
      elif ui.y &gt; ui.x:
          print(f"y is larger then x: x is {ui.x} and y is {ui.y}")
      elif ui.y == ui.x:
          print(f"x is equal to y: x is {ui.x} and y is {ui.y}")     
      else:
          print("Dont know mate")
  
  n = 0
  while(n &lt; 3):
      checknumbers()
      n += 1
  </code></pre>
  
  <p>Ideal solution, so both functions <code>getnumbers()</code> and <code>checknumbers</code> are clean cut independent of each other and they are being called inside the while loop, the problem is that x and y from the <code>getnumbers()</code> function are unknown to <code>checknumbers</code>.</p>
  
  <p>The requirement is: I cant have any reference to any other function inside my functions, how do I pass x and y without referencing them?:</p>
  
  <pre><code>def getnumbers():
      x = input("Enter the X number: ")
      y = input("Enter the Y number: ")
      return x, y
  
  def checknumbers():
      if   x &gt; y:
          print(f'x is larger then y: x is {x} and y is {y}')
      elif y &gt; x:
          print(f"y is larger then x: x is {x} and y is {y}")
      elif y == x:
          print(f"x is equal to y: x is {x} and y is {y}")     
      else:
          print("Dont know mate")
  
  
  n = 0
  while(n &lt; 3):
      getnumbers()
      checknumbers()
      n += 1
  </code></pre>