I am new to python and have a problem with a hangman game that I was making. So I have a list called "current" which is filled with hyphens (-) the same amount of times as the length of the word the person is guessing. When they guess a letter correctly it replaces the hyphen with the letter in the correct place. The problem I have is that if there are 2 or more of the same letter in a word then it works for the first time the letter comes up but after that it will say the letter has already been guessed therefore it doesn't work and I cant figure out how to fix this.
current = "_" * len(theword)
x = list(current)
print (x)
guessed = []
while current != theword and lives > 0:
print ("You have %d lives left" % lives)
guess = input("Please input one letter or type 'exit' to quit.")
guess = guess.lower()
if guess == "exit":
break
elif guess in guessed:
print ("You have already guessed this letter, please try again.")
guessed.append(guess)
if guess in theword:
index = theword.find(guess)
x = list(current)
x[index] = guess
current = "".join(x)
print ("Correct! \nYour guesses: %s" % (guessed))
print(x)
else:
print ("Incorrect, try again")
lives = lives -1
if current == theword:
print ("Well done, you have won!")
Thanks