Python indentation mystery

后端 未结 3 2036
别跟我提以往
别跟我提以往 2021-01-27 00:47

Why am I getting the following error? The last print statement should not be a part of the while loop.

>>> while n>= 0:
.         


        
3条回答
  •  青春惊慌失措
    2021-01-27 01:29

    I guess that the error shows up because python shell don't support that. It want you to do one thing in a time.! I do the same things in my python 2.7 shell and it said:

    File "", line 4
        print 'to all'
                     ^
    IndentationError: unindent does not match any outer indentation level
    

    when I do the same thing in my python 3.4 shell, it said: unexpected indent.

提交回复
热议问题