为了检查猜测结果,我们将循环遍历 guess 列表和 code 列表两次,来比较颜色和位置。

  • 使用 Define Function with Parameters ,并将下列变量作为参数包含: guesscodey
  • 添加两个 Integer Variable , 其中一个名为 x ,值为 85。另一个名为 peg_num ,值为 0
  • 添加两个空列表。将其中一个命名为 colors_tried ,将另一个命名为 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)