Current output: 'a _ _ l e
Desired output: 'a _ _ l e'
I am unsure how to get the quotation mark at the end of the output in the for loop. This is a function for a Hangman game where provided variables are the secretWord and a list of the lettersGuessed.
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.
'''
print("'",end=""),
for letter in secretWord:
if letter in lettersGuessed:
print (letter, end=''),
else:
print ("_",end=''),
return letter
getGuessedWord('apple', ['e', 'l', 'k', 'o', 'a', 's'])