This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tutorial example IndentationError?
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Erwin Berkouwer, SilentGhost, docs@python
Priority: normal Keywords:

Created on 2016-03-20 12:38 by Erwin Berkouwer, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
IndentationError.jpg Erwin Berkouwer, 2016-03-20 12:38
Messages (2)
msg262072 - (view) Author: Erwin Berkouwer (Erwin Berkouwer) Date: 2016-03-20 12:38
being totally new to Python, I tried actually doing the examples from the beginners guide (real RTFM ;-)

however I fail at the first example, with an error message that I don't understand. please clarify. attached file is screenprint from documentation, below what's on my screen (note I keyed in the example, no copy/paste, but I think correctly)

Also adding spaces or a tab doesn't get rid of the error.


C:\Users\erwin>python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
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
msg262076 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2016-03-20 13:46
Erwin, you could clearly see in the screenshot that the print call is indented, i.e. it starts in the 5th column, under letter "h" of the_world_is_flat. In what you've typed here one can clearly see that "p" of print is under "i" of if (the 1st column) and is therefore not indented. Indentation is an important part of Python syntax.

To properly copy this example from documentation into interpreter you could click on button in the top right corner of the code block - it's cut off in your screenshot, but it looks like a python prompt (>>>).
History
Date User Action Args
2022-04-11 14:58:28adminsetgithub: 70781
2016-03-20 13:46:10SilentGhostsetstatus: open -> closed

type: behavior

nosy: + SilentGhost
messages: + msg262076
resolution: not a bug
stage: resolved
2016-03-20 12:38:56Erwin Berkouwercreate