[Tutor] Hi Dear!
Emil Natan
shlyoko at gmail.com
Thu Feb 4 09:36:51 EST 2016
On Thu, Feb 4, 2016 at 2:49 PM, Alexa kun <alexgnuant at gmail.com> 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!")
>
> I got answer
>
> IndentationError: expected an indented block
>
> [root at localhost /]# python3
> Python 3.4.3 (default, Jun 29 2015, 12:15:26)
> [GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> the_world_is_flat = True
> >>> if the_world_is_flat:
> ... print(Be careful not to fall off!)
> File "<stdin>", line 2
> print(Be careful not to fall off!)
> ^
> IndentationError: expected an indented block
> >>>
>
>
You should have the print function indented, usually by 4 spaces. This is
how Python knows which commands to be executed as part of the if block. So
this is what you'll make your code work:
>>> the_world_is_flat = True
>>> if the_world_is_flat:
... print("Be careful not to fall off!")
...
Be careful not to fall off!
The interpreter also tries to help you, it puts ... at the begging of the
line (instead of >>>) which means it expect some indentation.
Emil
I have installed Python3 in Linux Fedora 23
> Please tell my why Python3 doesn't work?
>
> Sincerely!
> Alexander
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list