Python “expected an indented block”

前端 未结 9 1194
广开言路
广开言路 2020-12-09 08:00

Let me start off by saying that I am COMPLETELY new to programming. I have just recently picked up Python and it has consistently kicked me in the head with one recurring e

9条回答
  •  盖世英雄少女心
    2020-12-09 08:39

    The body of the loop is indented: indentation is Python’s way of grouping statements. At the interactive prompt, you have to type a tab or space(s) for each indented line. In practice you will prepare more complicated input for Python with a text editor; all decent text editors have an auto-indent facility. When a compound statement is entered interactively, it must be followed by a blank line to indicate completion (since the parser cannot guess when you have typed the last line). Note that each line within a basic block must be indented by the same amount.

    src: ##

    ##https://docs.python.org/3/tutorial/introduction.html#using-python-as-a-calculator

提交回复
热议问题