STEP 19: Let's make the for loop stop if the user has guessed all the letters correctly!

  • From add if not in inside the for loop. It should be indented ONCE, so it is in the for loop.
  • Change the test value from my_var to "#", and the list to hidden_list. We replace every "#" with a letter when the player guesses correctly, so if there are no "#" left then the user has guessed all letters correctly!
  • From , add Break in the if-block, indented twice! This ends the loop when the player wins!

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)