警告:此程序有语法错误!它尝试使用应该作为返回变量包含的变量。

我们使用返回变量来存储从函数内部返回的信息。

  • 点击运行并阅读错误消息。变量new_grade未定义!
  • 我们看到函数calculate_grade()有一个return 语句,但它是否存储在return 变量中?
  • 通过将calculate_grade()的结果存储在返回变量new_grade中来修复此程序。

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)