I am trying to create a simple hangman game, with the goal output being like this:
player chooses the letter m
Output: m______
You have found the letter m
Guesses Left: 7
Input guess
However, the output I am getting is this:
You have found the letter m
"_________" (no quotations)
Guesses Left: 7
Input guess
I am wondering why _____ is not being replaced with m________
word = "mystery"
solved = 1
guesses = 7
solver = 0
o = "_______"
while solved == 1:
print(o)
print("Guesses Left:", guesses)
print("Input guess")
guess = str(input())
x = word.find(guess)
if x > -0.5:
print("You have found the letter", guess)
z = o[x:x]
o.replace(_, guess)
solver = solver + 1
if solver == 7:
print("YOU WON!!!!")
solved = 2
else:
guesses = guesses - 1
if guesses == 0:
print("Out of lives...")
solved == 0
Thanks!