5-7问题中要求计算奇数的和,但答案显示的是所有偶数所加的和
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x % 2 == 1:
continue
sum = sum + x
print sum
我所写的代码是0-100中奇数之和
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x % 2 == 1:
continue
sum = sum + x
print sum
我所写的代码是0-100中奇数之和
2018-02-28
举报