课程
/后端开发
/Python
/初识Python
sum = 0x = 1n = 1while True: sun = sum + x x = x*2 n = n+1 if n >20: breakprint (sum)
请问哪错了
2018-06-07
源自:初识Python 5-6
正在回答
sum=0 x=1 n=1 while True: sum=sum+x x=x*2 n=n+1 if n>20: break print (sum)
代码没问题,注意格式!
sum = 0
x = 1
n = 1
while True:
sun = sum + x
x = x*2
n = n+1
if n >20:
break
print (sum)
举报
学python入门视频教程,让你快速入门并能编写简单的Python程序