Latest web development tutorials

Pythonは演習45を含んでいます

Pythonの100リー Pythonの100リー

タイトル:統計1-100合計。

プログラム解析:なし

ソースコード:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

tmp = 0
for i in range(1,101):
    tmp += i
print 'The sum is %d' % tmp

上の例の出力は、次のとおりです。

The sum is 5050

Pythonの100リー Pythonの100リー