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

在 Python 中,有时最好乘以小数来进行除法。请记住,我们使用星号*进行乘法运算。

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

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)