QUESTION IMAGE
Question
your program has a loop where a user guesses a letter. your program compares the guess to each letter in the word. finish the code. for n in range(lenword): if == letter: blanks = blanks:n + letter + blanksn+1:
Step1: Understand the loop
The loop iterates over the indices of the word. We need to access each character of the word at the current index n to compare with the guessed letter.
Step2: Fill in the comparison
In Python, to access a character of a string at a particular index, we use square - brackets. So the missing part should be the way to access the character of the word at index n. Assuming the word is stored in a variable named word, the correct code to fill in the blank is word[n].
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
word[n]