在continue循环习题和while循环中x=1有什么区别?求解原理
为什么前者在条件if x>100时就变成了x=2,而后者在while x<100时仍是x=1?
contuinue循环练习:计算100内奇数之和
sum = 1
x = 1
while True:
x = x + 1
if x > 100:
break
if x % 2 == 0:
continue
sum = sum + x
print sum
while循环习题:计算100以内奇数和
sum = 0
x = 1
while x < 100:
sum = sum +x
x = x +2
print sum