顺序不一样,结果就不一样。。。?
sum = 0
x = 1
while x < 100:
sum = sum + x
x = x + 2
print sum
sum = 0
x = 1
while x < 100:
x = x + 2
sum = sum + x
print sum
第一个结果是2500 ,第二个结果是2600
sum = 0
x = 1
while x < 100:
sum = sum + x
x = x + 2
print sum
sum = 0
x = 1
while x < 100:
x = x + 2
sum = sum + x
print sum
第一个结果是2500 ,第二个结果是2600
2020-06-20
举报