我用幂函数结果是对的,怎么还是报错
sum = 0
x = 1
n = 1
while True:
sum = sum + 2^(x-1)
x = 2*x
n = n + 1
if n > 20:
break
print sum
sum = 0
x = 1
n = 1
while True:
sum = sum + 2^(x-1)
x = 2*x
n = n + 1
if n > 20:
break
print sum
2019-04-25
举报