title: Newton’s method for finding square roots in python
body: <p>This is a function that uses Newton's method to solve for the square root of a given number:</p>
  
  <pre><code>def sqrt(n):
      approx = n / 2.0
      while True:
          better = (approx + n / approx) / 2.0
          if abs(approx - better) &lt; 0.00001:
              return better
          approx = better
  </code></pre>
  
  <p>What I do not understand is, that the function only returns "better", which is a integer, but the while loop depends on a Boolean, so how is the while loop ever going to stop? Where does the function returns a False to terminate the while loop?</p>
  
  <p>Many thanks in advance.</p>