title: Comparison with previous iteration in while loop
body: <p>I have the following <code>while</code> loop where I try to calculate an equation and I would like to add an <code>if</code> condition for the equation output to compare the results with the previous iteration. You see my attempt so far but it doesn't work!</p>
  <pre><code>Tin1 = 1.0
  stepsize = 0.0001
  const = 0.09929
  cor = 25000
  
  value_out = []
  
  while Tin1 &lt; 2:
      EQ = (Tin1**(3.125))*np.absolute(1-Tin1**(-1.5))
      Tin1 = Tin1+stepsize
      if (EQ[i] &gt; const) and (EQ[i-1] &lt; const):
         value = Tin1
         value_cor = value * cor
         value_out.append(value_cor)
  </code></pre>