I'm trying to make a hangman game (with only 6 letter words) and I'm trying to write the code for when there is more than 1 of a certain letter (inputted by the user) in the word
tries = 0
n = 0
word = random.choice(word_list)
print(word)
while tries<10:
guess = input("Input a letter: ")
if guess in word:
n = n + 1
print("Correct. You've got,", n,"out of 6 letters.")
if n == 6:
print("You guessed correctly, the word was,", word)
break
elif word.guess(2):
n = n + 2
print("Correct. You've got,", n,"out of 6 letters.")
if n == 6:
print("You guessed correctly, the word was,", word)
break
although the program continues after a double letter is inputted for guess (eg. 's' in 'across') it still doesn't add up the correct number in the 'n' variable