My loop seems to iterate over the first letter and then breaks though it's supposed to iterate through each letter in the secretWord, for example, the code bellow is supposed to print out "_pp_e" but instead it only prints "_". I don't understand, what's the problem with that code??
def getGuessedWord(secretWord, lettersGuessed):
'''
secretWord: string, the word the user is guessing
lettersGuessed: list, what letters have been guessed so far
returns: string, comprised of letters and underscores that represents
what letters in secretWord have been guessed so far.
'''
# FILL IN YOUR CODE HERE...
for letter in secretWord:
if letter in lettersGuessed:
return letter
else:
return '_'
print(getGuessedWord("apple", ['e', 'i', 'k', 'p', 'r', 's']))