Let's create another loop to test for the guesses that are the correct color but not the correct position.

  • Use another Loop with Range inside the function. Change the counter to peg_num and the range to 4.
  • Check if guess[peg_num] is in code and not in colors_tried and not in colors_matched.
  • 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)