import random stages = [''' +---+ | | O | /|\ | / \ | | ========= ''', ''' +---+ | | O | /|\ | / | | ========= ''', ''' +---+ | | O | /|\ | | | ========= ''', ''' +---+ | | O | /| | | | =========''', ''' +---+ | | O | | | | | ========= ''', ''' +---+ | | O | | | | ========= ''', ''' +---+ | | | | | | ========= '''] logo = ''' _ | | | |__ __ _ _ __ __ _ _ __ ___ __ _ _ __ | '_ \ / _` | '_ \ / _` | '_ ` _ \ / _` | '_ \ | | | | (_| | | | | (_| | | | | | | (_| | | | | |_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_| __/ | |___/ ''' print(logo) word_list = ['danish', 'hamza', 'awais', 'alia', 'zimna', 'aiza'] chosen_word = random.choice(word_list) word_length = len(chosen_word) #Testing code # print(f'Pssst, the solution is {chosen_word}.') #Create blanks display = [] for _ in range(word_length): display += "_" #TODO-1: - Use a while loop to let the user guess again. The loop should only stop once the user has guessed all the letters in the chosen_word and 'display' has no more blanks ("_"). Then you can tell the user they've won. end_of_game = False lives = 6 while not end_of_game: guess = input("Guess a letter: ").lower() #Check guessed letter for position in range(word_length): letter = chosen_word[position] #print(f"Current position: {position}\n Current letter: {letter}\n Guessed letter: {guess}") if letter == guess: display[position] = letter print(display) if guess not in chosen_word: lives -= 1 if lives == 0: end_of_game = True print("You Loose") #Check if there are no more "_" left in 'display'. Then all letters have been guessed. if "_" not in display: end_of_game = True print("You win.") print(stages[lives])