Now let's test if each color and position in the guess is an exact match.

  • Add a Loop with Range. Change the counter to peg_num and the range to 4.
  • Use if else to check if the guess at index [peg_num] is equal to the code at index [peg_num].
  • If it is equal, add a "black" Circle called marker with coordinates x and y and a diameter of 15.
  • If it is equal, Append guess[peg_num] to the colors_matched list.

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
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)