Skip to content

Call a function · ⁨调用一个函数⁩

English

Call a function

greet is already written for you. Call it with "Mia" so the program prints "Hello, Mia".

Writing def only describes the function — nothing happens until you call it by name with brackets: greet("Mia"). The call goes at the left margin, outside the def.

中文

调用一个函数

greet 已经替你写好了。用 "Mia" 调用它,让程序打印 "Hello, Mia"。

写 def 只是描述了这个函数 —— 在你用名字加括号调用它之前什么都不会发生:greet("Mia")。调用要写在最左边,在 def 外面。

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

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