求教:该代码输出后比正确答案大一倍
num = 1
sum = 0
while True:
if num % 2 > 0:
num + 1
if num > 1000:
break
sum = sum + num
num = num + 1
print(sum)
num = 1
sum = 0
while True:
if num % 2 > 0:
num + 1
if num > 1000:
break
sum = sum + num
num = num + 1
print(sum)
2021-07-01
举报