Hangman (not printing guessed letters)-python
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
how do I bring it from that to:
Voters
Using variables and lists
Instead of this:
You could use this:
The output would be
And if a letter would be guessed, simply redefine the letter.
Output would now be
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.
@Axrevyn I get the idea, but won't that work only with only one type of length for example:
letters = ["","","",""]
print(letters[0], letters[1], letters[2], letters[3])
↑ the above code type will only work with four letter words not with words with other lengths
I will try it to make it more flexible but if possible
give me a more flexible idea
and thank you for replying
@Aayan11 It was a rough mock-up. Would you like me to help?
@Aayan11
In this case, just define
lm
as the number of letters in the word and you can let the rest of the code do its thing.