STEP 14: We sorta fixed the logic error in the last activity. Let's test the program thoroughly to see how it works!

.index() only finds the first occurrence of a value. To find duplicates, we need to change the value we found!

  • Click Run and enter error as the word-to-guess. What happens now when you guess r twice?

The program now says that r is correct and reveals another r in the word. This isn't totally fair for our guesser! Let's make it so that guessing a letter correctly will reveal every one of that letter in the word.

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)