all versions of python fail to indent after conditional statement

MRAB python at mrabarnett.plus.com
Fri Apr 2 11:41:24 EDT 2021


On 2021-04-02 01:40, mikedianeterry at gmail.com wrote:
> 
> 
>     The following snap shot of system prompt illustrates my problem. I have
>     tried 3.8, 3.92 and 3.10 with the same result. When I run in the window
>     interface it doesn't even display one row of ... but does print if I hit
>     return twice. I'm new to Python and was excited about learning it but am
>     becoming very frustrated over a bug in such a simple conditional statement
>     - please help as I would really like to master Python.
> 
>     Regards,
> 
>     Michael Terry
> 
> 
> 
>     Microsoft Windows [Version 10.0.19041.867]
> 
>     (c) 2020 Microsoft Corporation. All rights reserved.
> 
>     C:\WINDOWS\system32>py
> 
> 
> 
>     Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64
>     bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for
>     more information.
> 
> 
> 
>     >>> dog_has_fleas=True
> 
>     >>> if dog_has_fleas:
> 
>     ... print('too bad')
> 
>       File "<stdin>", line 2
> 
>         print('too bad')
> 
>         ^
> 
>     IndentationError: expected an indented block
> 
It said that it expected an indented block. You didn't indent the block.

Python uses indentation, but the Python prompt doesn't indent 
automatically, you have to do that yourself.


More information about the Python-list mailing list