print("不及格") ^ IndentationError: expected an indented block after 'if' statement on line 2
时间: 2024-05-14 12:14:10 浏览: 157
Python--学习笔记.docx
This error occurs when there is an 'if' statement but there is no indented block after it. In Python, indentation is used to indicate which lines of code are part of a particular block or statement.
To fix this error, you need to add an indented block after the 'if' statement. For example:
```
score = 50
if score < 60:
print("不及格")
```
Here, the indented block after the 'if' statement contains the code that should be executed if the condition is true (i.e. if the score is less than 60). Without the indented block, Python doesn't know what code to execute if the condition is true, which is why it raises an IndentationError.
阅读全文