word = input("Give me the hidden word:") correctletters = "" incorrectletters = "" def drawhangman(word, correctletters, incorrectletters): output = "" for c in word: if c in correctletters: output += c + " " else: output += "_ " print(output) #drawhangman("rule", "eul", "") #drawhangman("rule", "ul", "") #drawhangman("rule", "l", "") #drawhangman("rule", "", "") #drawhangman("rule", "erul", "") while len(word) != len(correctletters) and len(incorrectletters) < 8: guess = input("Guess a letter:") if guess in word and guess not in correctletters: correctletters += guess elif guess not in incorrectletters: incorrectletters += guess drawhangman(word, correctletters, incorrectletters) |
Bronze Announcements >