الكود هو هذا هنا

import random
 
# عمل قائمة لحالات الدمية
hangman_ascii = ['''
  +---+
  |   |
      |
      |
      |
      |
=========''', '''
  +---+
  |   |
  O   |
      |
      |
      |
=========''', '''
  +---+
  |   |
  O   |
  |   |
      |
      |
=========''', '''
  +---+
  |   |
  O   |
 /|   |
      |
      |
=========''', '''
  +---+
  |   |
  O   |
 /|\  |
      |
      |
=========''', '''
  +---+
  |   |
  O   |
 /|\  |
 /    |
      |
=========''', '''
  +---+
  |   |
  O   |
 /|\  |
 / \  |
      |
=========''']
 
# انشاء كلمة عشوائية بين كلمات القائمة
words = ["good","bad","ugly"]
random_word = random.choice(words)
 
# انشاء مسافات بنفس عدد حروف الكلمة
display = ["_"] * len(random_word) 
 
print(" ".join(display))
lives = 6
guess = []
print(hangman_ascii[0])
while "_" in display and lives > 0:
    # طلب تخمين حرف
    guessed = input("Please guess a letter: ").lower()
 
    # اذا كان الحرف مخمن قبل
    if guessed in guess:
        print("You already guessed that. Try again.")
        print(f"You have {lives} more tries")
        continue
    guess.append(guessed)
 
    # اذا الحرف المخمن غير موجود في حرف الكلمة العشوائية 
    if guessed not in random_word:
        lives -= 1
        print(hangman_ascii[6-lives])
 
    # اذا كان الحرف المخمن موجود في حرف الكلمة العشوائية    
    else: 
        for position in range(len(random_word)):
            if random_word[position] == guessed:
                display[position] = guessed
    print(" ".join(display))
    print(f"You have {lives} more tries")
 
# اذا انتهت المحاولات
if lives == 0:
    print(f"""
    *****
    *  YOU LOSE *
    *****
    {hangman_ascii[-1]}
""")
 
# اذا فاز المستخدم
else:
    print("""
    *****
    *  YOU WIN  *
    *****""")