Traceback (most recent call last): File "main.py", line 89, in update = guesses[i] IndexError: list index out of range
On line 89, only happens if you input a correct letter, I know it's because of the list not having a way to stop after a certain number but I don't know what to add to make that happen, I thought I knew but my mind is blank.
Code area that has error
update = ""
for i in range(len(word)):
if Guess == word[i]:
update = Guess
else:
update = guesses[i]
guesses = update
Full code: https://github.com/BUBBLEGUM846/BUBBLEGUM846/blob/main/Hangman
CodePudding user response:
i mean, you could do
update = ""
for i in range(len(word)):
try:
if Guess == word[i]:
update = Guess
else:
update = guesses[i]
except:
pass
guesses = update
its extremely crude, but it works