第 8步:现在我们将遍历我们的sample_space列表来计算每种颜色出现的次数!

请记住,当我们遍历一个列表时,程序对列表中的每个值执行相同的操作!

  • 在逻辑中,单击.拖出Loop through List 。将列表名称更改为sample_space
  • 点击.将Get Count拖动到新循环中。将 = 之前的名称更改为freq
  • 将列表名称更改为outcome_list 。将.count()中的参数更改为value

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)