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

  • Click LOGIC, go to and drag out if. Drop it indented once inside of the for loop.
  • Change the test variable from choice to guess and the test value from "yes" to rand_num.
  • Click GRAPHICS and . Drag Say inside of the if-statement and assign it to computer.

.say() must be indented twice because it's inside a loop and an if-statement! ········ should show before it!

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)