I'm a beginner in python and I am trying to make a hangman game but I can't seem to get it to work. Here's my code:
word = "street"
letters = list(word)
dashes = ["_","_","_","_","_","_"]
guess = input("Guess the letter. ") #assuming that "e" was the input
x = [index for index, value in enumerate(letters) if value == guess]
dashes[x] = guess
I want to replace in dashes in dashes that have the indexes in x. In the case of "e" being the input that means dashes[3] and dashes[4] become "e". dashes[x] = guess doesn't seem to work.