STEP 8: The user gets three guesses, which means that we need an ask command inside the for-loop.

  • Go to and drag Ask for Integer inside the for loop. It should have a ···· in front of it.
  • Change the name in front of .ask() from sprite to computer.
  • Change the string in .ask() to "What do you think my number is?"

Notice the int() at the beginning of .ask(). That is casting our user input from a string to an integer!

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)