Why am I getting the following error? The last print
statement should not be a part of the while
loop.
>>> while n>= 0:
.
The default python shell works OK for typing but it really does not understand pasting from clipboard. The real solution is to install ipython
, which is an advanced shell for python with many niceties:
% ipython3
Python 3.4.2 (default, Oct 8 2014, 13:08:17)
Type "copyright", "credits" or "license" for more information.
IPython 2.3.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: n = 5
In [2]: while n >= 0:
...: n = n-1
...: print(n)
...: print ("TO A!!")
...:
4
3
2
1
0
-1
TO A!!
In [3]: