Hey,
I've just started to learn Python and I'm creating the game Hangman. I've got the basic functionality down. I have a list containing the words and they're randomly selected. I have an input for the user to guess letters and check it against the list that the word is split into, I have another list that the correctly guessed letters are put into at the position they are in the randomly selected word.
The problem I am having is that if the word has a letter within it more than once, it will only find the first letter and add that. How would I go about looking for all instances of a letter and adding them?
This is the code I'm using to map guessed letters against the randomly selected word.
if user_input in choose_word:
print "Good guess!"
print trys_remaining, "trys remaining!"
word_index = letter_list.index(user_input)
correct_letters[word_index] = user_input
If anyone could point me in the right direction, it would be great.