In the last loop, we'll allow the player to guess the code 10 times and break the loop if they guess correctly.

  • Outside of the function, create an Integer Variable named y equal to -115.
  • Add a Loop with Range and change the range to 10.
  • Use a Return Variable to call the function guess_code.
  • Name the return variable guess and use the parameter y.

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)