YouTip LogoYouTip

Python Exercise Example45

# Python2.x Python Exercise Instance 45 [![Image 3: Python 100 Examples](#) 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 [![Image 4: Python 100 Examples](#) Python 100 Examples](#)
← Python Exercise Example46Python Exercise Example44 β†’