title: Python finding n as 101 instead of 100
body: <p>Python loops are finding n as 101 instead of 100, I am getting the average of 5050 as 50 instead of 50.50, What could be the problem? How should I go through it? Here is my function.</p>
  
  <pre><code>def sum_and_average(n):
      total = 0
      for i in range(1, n+1):
          total += i
      average = float(total/n)
      print "the sum is %d and the average is %f" %(total, average)
  
  sum_and_average(100)
  </code></pre>
  
  <p>It returns:</p>
  
  <pre><code>the sum is 5050 and the average is 50.000000
  </code></pre>