def isWordGuessed(secretWord, lettersGuessed):
'''
secretWord: string, the word the user is guessing
lettersGuessed: list, what letters have been guessed so far
returns: boolean, True if all the letters of secretWord are in lettersGuessed;
False otherwise
'''
score = 0
tot = len(secretWord)
for i in range(len(secretWord)):
for j in range(len(lettersGuessed)):
if (secretWord[i] == lettersGuessed[j]):
score +=1
if score == tot:
return True
else:
return False
For most of the words and guess letter m getting correct answer but while providing sceretWord as mangosteen and letter guessed as ['z', 'x', 'q', 'm', 'a', 'n', 'g', 'o', 's', 't', 'e', 'e', 'n'] I am getting wrong output.
Any suggestions, why?