title: Noob question updating variable in a function
body: <p>I was watching a online guide about calling a function to calculate a square root using the Newton method:</p>
  <p><img src="https://i.stack.imgur.com/VsxMp.png" alt="screenshot showing Newton method formula" /></p>
  <p>What I cannot get my head around is that you need to update the variable in the <code>for</code> loop to get the result.</p>
  <p>Can anyone help me figuring out the logic behind this?</p>
  <pre><code>def compute_sqrt(n, num_loops):
      result = n/2
      
      for i in range(num_loops):
          result_1 = (result + n/result) / 2
          result = result_1
          
      return result_1
  
  computesqrt(n=100,num_loops=10)
  </code></pre>