1. 程式人生 > >python3 練習題100例 (十九)

python3 練習題100例 (十九)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""練習十九:計算1-2+3...+99中除了88以外所有數的和"""

__author__ = 'Fan Lijun'

s1 = 0
s2 = 0
for x in range(1, 100, 2):
    s1 += x
for y in range(2, 100, 2):
    s2 += y

print(s1 - s2 + 88)