WARNING: This program should find each occurrence of a letter in a word, but it's getting stuck in an infinite loop!

  • For example, "apple" has two occurrences of "p" (one at index 1 and one at index 2).
  • Click Run and try to find s in the word. Uh oh! This loop is infinite! Click Stop to end the program.
  • Find this code: word_list[letter_index]·=·letter and add .upper() to the end of letter.
  • This stops the while loop by replacing each letter that it finds with an uppercase version! Search for s again!

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)