课程
/后端开发
/Python
/初识Python
sum = 0 x = 1 n = 1 while True: sum = sum + x n=n+1 x = 2^(n-1) if n > 20 break 为什么结果不对
2018-04-17
源自:初识Python 5-6
正在回答
在去试一试。多刷新下,清除下缓存等。
zvumqvkarngigaplylnvgdwrtkdzbxjjkqyhaxeeqpropqmmlkcfictrbebfnwrvgoxzgkgjwyjlrhheuqkyqbliram
sum = 0 n = 0 while n < 20: sum = sum + 2 ** n n = n + 1 return sum print sum
sum = 0
x=1
n=1
while n<=20 :
sum = sum + x
x=x*2
n=n+1
print sum
举报
学python入门视频教程,让你快速入门并能编写简单的Python程序