Python-100-Days/Day01-15/code/Day04/while2.py

14 lines
175 B
Python
Raw Normal View History

2018-03-02 00:09:06 +08:00
"""
用while循环实现1~100之间的偶数求和
Version: 0.1
Author: 骆昊
Date: 2018-03-01
"""
2019-06-12 01:23:30 +08:00
sum, num = 0, 2
2018-03-02 00:09:06 +08:00
while num <= 100:
2019-05-03 21:17:36 +08:00
sum += num
num += 2
2018-03-02 00:09:06 +08:00
print(sum)