STEP 5: We also need to keep track of whether the user has won or not.

A boolean variable can have only TWO values: either True or False.

  • In LOGIC, click on and drag in Boolean Variable.
  • Change the variable name from my_var to correct_answer
  • Change the value from True to False. (In the beginning, the user hasn't guessed correctly yet.)

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)