Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

your program has a loop where a user guesses a letter. your program com…

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:

Explanation:

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].

Answer:

word[n]