为什么我算出来是2600
sum = 0
x = 1
while x < 100:
x = x + 2
sum=sum+x
print sum
得出得结果是2600
但只要把
x = x + 2
sum=sum+x
调换上下顺序
sum=sum+x
x = x + 2
则能算出正确答案2500,为什么???
sum = 0
x = 1
while x < 100:
x = x + 2
sum=sum+x
print sum
得出得结果是2600
但只要把
x = x + 2
sum=sum+x
调换上下顺序
sum=sum+x
x = x + 2
则能算出正确答案2500,为什么???
2018-06-19
举报