Skip to content
English

Name a block of code

  • A function is named code you can use again and again.
  • Make one with def name(): and an indented body.
  • "Calling" the function by its name runs that code.
中文

给一段代码起个名字

  • 函数(function)是一段有名字、可以反复使用的代码。
  • 用 def name(): 加上缩进的函数体来定义它。
  • 用名字"调用"这个函数,就会运行那段代码。

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩