第 6 步:现在让我们开始循环遍历列表以找到所有值的总和!

我们将使用符号+=添加到变量的现有值。

  • 在逻辑中,单击.拖出Loop through List 。将列表的名称更改为my_data
  • 点击.将Add Value拖动到循环中。将变量名称更改为total
  • 将数字1更改为变量值,使该行如下所示: ····总计· += ·

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)