第四步:你注意到主函数第一行的绿色文字了吗?此文本是一个文档字符串。

文档字符串是一种特殊类型的注释,用于解释和记录函数的作用。

  • 让我们在set_stage()中添加一个文档字符串,因为那里没有。我们将在每个函数下放置一个!
  • 并拖入Docstring使其成为set_stage()下缩进的第一行。
  • 更改文档字符串中的文本,使其""" Sets up the stage for the game """

To navigate the page using the TAB key, first press ESC to exit the code editor.

def set_stage(): stage.set_background("soccerfield") stage.disable_floor() def main(): """ Sets up the program and calls other functions """ set_stage() main()
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)