现在让我们来检查一下猜测的每个颜色和位置是否完全匹配。

  • 添加一个 Loop with Range。将计数器更改为 peg_num ,范围更改为 4
  • 使用 if else 检查索引 [peg_num]处的guess 是否等于 [peg_num]处的 code
  • 如果相等,则添加一个名为 marker"black" Circle ,带有 xy 坐标,直径为 15
  • 如果相等,将 guess[peg_num]Append colors_matched 列表。

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)