课程
/后端开发
/Python
/初识Python
sum = 0
x = 1
while True:
if x > 100:
break
if x % 2 == 0:
continue
sum = sum + x
x = x + 1
print sum
2017-09-25
源自:初识Python 5-7
正在回答
sum = 0x = 0while True: x = x + 1 if x % 2 == 0: continue if x > 100: break sum = sum + xprint sum
走第一遍x=2;第二遍开始一直在continue,x也没加,自然也不会有break
举报
学python入门视频教程,让你快速入门并能编写简单的Python程序