检查理解:这里有几个问题让你检查你学到了什么!

  • 点击出现提示时运行并输入数字。
  • 使用编辑器中的代码回答多项选择题。
  • 点击提交接下来继续。

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

def add_sprite(): """ Adds a player to the stage for the user to control """ person = codesters.Sprite("person3",0,-155) return person def add_numbers(a, b): """Add two numbers together and return the answer""" answer = a + b return answer def main(): """ Sets up the program and calls other functions """ person = add_sprite() num1 = int(person.ask("Enter a number")) num2 = int(person.ask("Enter a 2nd number")) sum = add_numbers(num1, num2) person.say("The sum is " + str(sum)) main()
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)