Skip to content
Hangman (not printing guessed letters)-python
Profile icon
Fire-Wizard

I have been trying to make a hangman game, Everything works fine except that it does not give the previous guessed letters in the correct places like the suppose the answer was "spoon" & you guessed the s first time you do it it will print in the proper place then you guess p the next one will look like

![image]
image

how do I bring it from that to:

image

You are viewing a single comment. View All
Profile icon
Axrevyn

Instead of this:

# The word here is "word" print("_ _ _ _")

You could use this:

letters = ["_","_","_","_"] print(letters[0], letters[1], letters[2], letters[3])

The output would be

____

And if a letter would be guessed, simply redefine the letter.

# Someone guessed the letter "o" letters[1] = "o" print(letters[0], letters[1], letters[2], letters[3])

Output would now be

_o__

This is just a rough mock-up, so you'll have to change it a bit to fit it into your program. I can help you with it if you'd like.