You don't need to type this out fully:
total_sum = total_sum+i Python has a += operator, basically shorthand for what you have above. Take what's on the left of the operator and add the result of what's on the right.
total_sum += i Also when in Python2.7 it's recommended you use for i in xrange(1000). range will immediately create a full list of numbers it stores in memory, while xrange is a generator that produces each number as it's needed. The performance difference is helpful for large ranges but it's generally a good habit to keep.