__author__ = 'zht' #!/usr/bin/env python # -*- coding: utf-8 -*- ''' #努力学习每一天 ''' #计算1~100之间偶数的累积和(包含1和100) i = 1 sum = 0 while i <= 100: if i % 2: sum = sum + i i += 1 print("1~100的累积和为:%d"%sum)