title: Sum the values of a nested for loops
body: <p>Can someone tell me in detail of how the the following code produce output 40? May need specify the values of j in details.</p>
  
  <pre><code>def temp3(): 
      sum = 0 
      for i in range(0,5): 
          for j in range (i,5): 
              sum += j 
      print(sum)
  </code></pre>