课程
/后端开发
/Python
/初识Python
sum = 0 x = 1 while x < 100: sum += 1 x +=2 print sum 怎么我的值是50
2017-08-17
源自:初识Python 5-5
正在回答
sum = 0x = 1N = 100while x < N: if x % 2 != 0: sum += x x += 1print sum
sum=sum+x,求的是所有奇数的和
sum处出现了错误,应该为sum=sum+x
sum+=x
x = 0
举报
学python入门视频教程,让你快速入门并能编写简单的Python程序