I’ve been trying to create Hangman in Python for a school assessment but I don’t understand what is going wrong. My problem here is that after the user guesses the final letter, it keeps on repeating.
import random import time name = input("What is your name? ") print(name + ", ay?") time.sleep(1) start = input("Up for a game of Hangman?(y/n) ") lis = random.choice(["yet"]) dash = [] while len(dash) != len(lis): dash.append("_") guess = [] guesscomb = "".join(guess) wrongcount=int(0) alphabet = "abcdefghijklmnopqrstuvwxyz" if start == "y": print("One game of Hangman comin' right up,",name) letter = input("Alright then, Guess a letter: ") thing = ''.join(dash) while guesscomb != thing: if letter == "" or letter == " " or len(letter) != 1: print("I don't understand. Please only use singular letters.") letter = input("Guess a letter: ") elif letter in lis and letter in alphabet: print("Nice!") location = lis.find(letter) dash[location] = letter guess.append(letter) alphabet.replace(letter," ") guesscomb = "".join(guess) letter = input("Guess a letter: ") else: print("Wrong.") wrongcount = wrongcount + 1 print("Total Mistakes:",wrongcount) letter = input("Guess a letter: ") elif start == "n": input("Shame.") quit() print("Good Job!") time.sleep(10) ```