第12步:现在我们来计算三角形的面积。

在Python中,我们使用斜杠 / 来表示除法。 记住,我们使用星号* 进行乘法。

  • 使 triangle_area 的值等于 triangle_width * triangle_height / 2
  • 这与使用公式 area = base x height ÷ 2 相同。

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)