Python Question 1: IndentationError: expected an indented block, expectedanindented
The Python language is a language that is very sensitive to indentation and brings confusion to many beginners. Even experienced python programmers may fall into a trap. The most common case is that the combination of tabs and spaces may cause errors or indentions, which cannot be separated by the naked eye.
This error occurs during compilation.IndentationError: expected an indented blockIt indicates that indentation is required here. You only need to indent the line with spaces or tabs (but cannot be mixed) When an error occurs.
Some people may wonder: why is it wrong if I don't indent at all? If I don't indent it, I have to indent it. If I don't indent it, it will lead to errors. For example:
If xxxxxx:
(Space) xxxxx
Or
Def xxxxxx:
(Space) xxxxx
And
For xxxxxx:
(Space) xxxxx
The next line with a colon always needs to be indented.