查找 Mistake: Missing Indentation
找错误 入门
题目
这个 code raises IndentationError. 什么是 错误?
代码
def greet(name):
print(f"Hello, {name}")
提示
行之后 def 应该是 indented.
解释
函数请求体是 不 indented. Python 需要请求体的 函数到 是 indented (典型地 4 空间) 相对到 def 行. fix 是到 indent print 语句.
相关资源
相关课程
- Python 函数
函数 indentation.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。