课程
/后端开发
/Python
/初识Python
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2=1:
continue
sum=sum+x
print (sum)
2018-12-09
源自:初识Python 5-7
正在回答
应该改成: if x%2==1:
‘=’是赋值语句,‘==’才是判断语句
sum = 0x = 0n = 2while True: x = x + 1 if x > 100: break if n == x: n = n+2 continue sum = sum +xprint sum
跟大家的方法不一样,虽然有些冗杂,也算是换个思路吧
举报
学python入门视频教程,让你快速入门并能编写简单的Python程序