Python Exercise Example45
# Python2.x Python Exercise Instance 45
[ Python 100 Examples](#)
**Title:**Calculate the sum of 1 to 100.
**Program Analysis:**None
Program source code:
## Instance
#!/usr/bin/python# -*- coding: UTF-8 -*-tmp = 0 for i in range(1,101): tmp += i print('The sum is %d' % tmp)
The output of the above instance is:
The sum is 5050
[ Python 100 Examples](#)
YouTip