1. 程式人生 > >sum=1+2+3+…+100

sum=1+2+3+…+100

col 等於 print blog span code int sum spa

sum = 1
for i in range(0,101):
    # sum = sum + i
    sum += i

print(sum)

sum +=i 等於 sum = sum + i

sum=1+2+3+…+100