计算 1~100 的和 5050

while 循环:

i, s = 0, 0

while i < 101:
    s += i
    i += 1
    
print(s)

 

for 循环:

s = 0

for i in range(101):
    s += i
    
print(s)