[Tutor] Hi Dear!

Steven D'Aprano steve at pearwood.info
Thu Feb 4 10:12:45 EST 2016

Hello Alexander, and welcome!

My answers are below, between your questions (starting with > quote 

On Thu, Feb 04, 2016 at 02:49:39PM +0200, Alexa kun wrote:
> Hi Dear!
> I newbie and read 2.1.2. Interactive Mode
> https://docs.python.org/3/tutorial/interpreter.html
> but when I type
> >>> the_world_is_flat = True
> >>> if the_world_is_flat:
> ...     print("Be careful not to fall off!")

Look carefully at the last line. Do you notice the indented space 
between the three dots ... and the print? You need to either press space 
at least once, or the TAB key, to indent the line.

> I got answer
> IndentationError: expected an indented block

Here Python tells you exactly what the problem is. Python expected an 
indented block of text (at least one line, indented by at least one 
space), but you didn't indent the line.

Python expects:

if the_world_is_flat:
	print(Be careful not to fall off!)

but you typed:

if the_world_is_flat:
print(Be careful not to fall off!)

without the indentation. You should press the TAB key to indent, or the 
SPACE key at least once.

Also, one last comment:

> [root at localhost /]# python3

I see from this that you are running Python as the root superuser. This 
is VERY dangerous for a beginner (and even for an expert). As root, you 
can over-write essential system files. Which means that if you 
accidentally give the wrong Python commands, you could break your system 
and leave it in a broken state where it needs to be re-installed.

It is MUCH safer to experiment as the regular user. If the command 
prompt shows # then you are running as root. If it shows $ then you are 
running as a regular user.


More information about the Tutor mailing list