title: How to loop a process
body: <p>I am learning Python and I am trying to create a simple function to do the following logic:</p>
  <ol>
  <li>Take two random numbers and random operation.</li>
  <li>The user will insert the right results.</li>
  <li>If the results correct, that system will take with another random number and random operation, and so on.</li>
  </ol>
  <p>I did the following but my issue that it is not taking the results are input for the next operation. Can you please review my code and tell me what I did wrong?</p>
  <pre><code>import random
  
  num = 1
  while num &lt; 100:
      x = random.randint(1,9)
      y = random.randint(1,9)
      opslist = ['+', '-', '*', '/']
      ops = random.choice(opslist)
      
      print(x,ops,y)
  
      if ops == '+':
          z = x + y
      elif ops == '-':
          z = x - y
      elif ops == '*':
          z = x * y
      elif ops == '/':
          z = x / y
  
      result = float(input(&quot;Please insert the result: &quot;))
      if result == z: x = z
      print(z)
      num = num+1
  </code></pre>