Lesson 9: Hangman v1

Post date: Dec 15, 2017 4:02:18 PM

print("Let's play Hangman")

word = input("Give me the word:")

word_dash = ""

for x in range(0, len(word)):

word_dash += "_ "

print (word_dash)

good_letters = ""

guess = input("Guess a letter:")

if word.find(guess) > -1:

print("Correct guess!")

good_letters += guess

else:

print("Wrong guess!")

word_dash = ""

for x in range(0, len(word)):

if good_letters.find(word[x]) > -1:

word_dash += word[x] + " "

else:

word_dash += "_ "

print(word_dash)