第 8 步:让我们完成add()函数!

  • 删除add()函数内缩进的Addition
  • 将变量名从my_var更改为total 。将2更改为num_1 ,将3更改为num_2 .
  • 从图形添加Say 。将字符串更改为"The sum is " + str( total )

我们使用字符串连接来连接"The sum is "totalstr()total从浮点数转换为字符串!

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

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)