title: Need help understanding Python Nested For Loop
body: <p>I'm having trouble understanding the 2nd for loop in the code below:</p>
  
  <pre><code>di = [4,5,6]
  for i in range(len(di)):
      total = di[i]
      for j in range(i+1,len(di)):
          total += di[j]
          curr_di = total / ((j-i+1)**2)
  </code></pre>
  
  <p>I can't visualize what happens in <code>for j in range(i+1,len(di)):</code>, in particular the <code>i+1</code> portion confuses me. how does the i in the first loop affect the 2nd loop, if any?</p>