Now Let's finish the game by stopping the loop if the player guesses the correct code.

  • Use another Return Variable to call the function analyze_code.
  • Name the return variable status and use the parameters: guess, code, and y.
  • Use an if statement to Break the loop if status is equal to "true!".
  • Inside the loop and outside the if statement, use Add Value to add 35 to y each time the loop runs.

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