STEP 9: We need an if-statement INSIDE of our for-loop to test if the user guessed the number correctly!

  • Go to and drag out If. Drop it inside of the for loop.
  • Change the test variable from choice to guess.
  • Drag out Say from and drop it inside of the if statement.

.say() will have purple and yellow indentation ········ because it's inside a loop and an if-statement!

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)