I'm currently studying Python 2.7 from an online course. One of the problems is I have to remove a char from a string based from a list of chars.
What I did was:
def getAvailableLetters(letters):
alphabet = string.ascii_lowercase
reduced_alphabet = ''
for char in alphabet:
if char not in lettersGuessed:
reduced_alphabet += char
return reduced_alphabet
I've learned that there's no such thing as a string method to directly remove a char from a string as they are immutable, so I came up with this. I've successfully submitted a correct answer, but I'm not quite satisfied with it as I feel like there's a more efficient way to do it.