I'm working through a Hangman problem in Python, which asks that I define a function that starts off with a string string.ascii_lowercase
(the letters of the alphabet) and a given list lettersGuessed
, and returns a string (in alphabetical order) of all letters that are not in lettersGuessed.
Here's what I've done so far:
def getAvailableLetters(lettersGuessed):
s = string.ascii_lowercase[:]
for letter in string.ascii_lowercase:
if letter in lettersGuessed:
s.replace(letter, '')
return s
However, for every test value of lettersGuessed
, this function just returns string.ascii_lowercase
, and not s
.
Where am I going wrong?|