Python break作业问题
>>> sum=0
>>> x=1
>>> n=1
>>> while True:
... sum=sum+x
... x=2**n
... n=n+1
... if n>20:
... break
... print sum
File "<stdin>", line 7
print sum
^
SyntaxError: invalid syntax
>>>
怎么会出错呢,网页上可以过得,可是python过不了
>>> sum=0
>>> x=1
>>> n=1
>>> while True:
... sum=sum+x
... x=2**n
... n=n+1
... if n>20:
... break
... print sum
File "<stdin>", line 7
print sum
^
SyntaxError: invalid syntax
>>>
怎么会出错呢,网页上可以过得,可是python过不了
2016-02-04
举报