while True:循环先后顺序一比一直导致结果不一致????
sum = 0
x = 1
n = 1
while True:
if n>20:
break
sum=sum+x
x=x*2
n=n+1
print sum
与
sum = 0
x = 1
n = 1
while True:
sum=sum+x
x=x*2
n=n+1
if n>20:
break
print sum
运行结果不一致:哪位大神能解答一下???
sum = 0
x = 1
n = 1
while True:
if n>20:
break
sum=sum+x
x=x*2
n=n+1
print sum
与
sum = 0
x = 1
n = 1
while True:
sum=sum+x
x=x*2
n=n+1
if n>20:
break
print sum
运行结果不一致:哪位大神能解答一下???
2016-07-28
举报