Simple hangman game from beginner This is my first project I am attempting in Python, and my first time on Stack Exchange, so please be kind.
The game uses a text file with lots of words. I was wondering how to improve the game by having different difficultly levels. E.g. easy for 1-4 letters, medium for 5-8 letters, hard for 9+ letters in the word.
All the code in print_graphics() was pre-made, so I have to figure out a way to incorporate it into the code I was writing.
I was also thinking it might look neater if it didn't keep printing new iterations of the hangman after each body part is added, but I'm not sure how I could do that without massively changing the text.
I couldn't figure out how to attach the input file so I've linked it instead.
import random
from IPython.display import clear_output
from termcolor import colored

def print_graphics(wrong_guesses):
    # list of possible body parts
    body_parts = ['  O     |', '  |     |',' /|     |', ' /|\    |', ' /      |', ' / \    |']
    
    # how many lines to print
    lines = 4 if wrong_guesses != 0 else 5

    # check number provided is usable
    if 0 &lt;= wrong_guesses &lt;= 6:
        print('  +-----+')  # print top of frame
        print('  |     |')
    
        # print the correct body parts for current state
        if wrong_guesses &gt; 0:
            if wrong_guesses &gt; 1:
                print(body_parts[0])
                lines -= 1
            if wrong_guesses &gt; 4:
                print(body_parts[3])
                lines -= 1
            print(body_parts[wrong_guesses-1])

        for i in range(lines):
            print('        |')  # print the lines
        
        print('==========')  # print the floor


with open(&quot;wordlist.txt&quot;) as file:
  words = file.read().split()
  word = random.choice(words)

guessed_word = []
guessed_letters = []
max_guesses = 5
length_word = len(word)
alphabet = &quot;abcdefghijklmnopqrstuvwxyz&quot;
letter_storage = []
body_parts = ['  O     |', '  |     |',' /|     |', ' /|\    |', ' /      |', ' / \    |']


def start():
  print(&quot;\033[1;34m&quot;+&quot;Welcome to hangman! You have 6 tries to guess the correct word, enter a letter to get started&quot;, &quot;\033[0;30m&quot;)
start()

def intro():
  for character in word:
    guessed_word.append(&quot;_&quot;)
  print(&quot;The word you are guessing has&quot;, length_word, &quot;characters&quot;)
  print_graphics(0)
intro()

def play(word):
  wrong_guesses = 0
  while wrong_guesses &lt;6:
    guess = input(&quot;Guess a letter or word: &quot;)

    if guess in guessed_letters:
      print(&quot;\033[1;31m&quot;+&quot;Whoops! You have already guessed this letter. Don't worry, you still have&quot;, 6-wrong_guesses, &quot;guesses remaining&quot; &quot;\033[0;30m&quot;)
    if guess not in alphabet:
      print(&quot;\033[1;31m&quot;+&quot;Character invalid. Please enter a letter&quot;, &quot;\033[0;30m&quot;)
    
    elif guess in alphabet and guess not in guessed_letters:
      if guess in word: 
        print(&quot;\033[1;3;32m&quot;+&quot;Well done&quot;, guess.upper(), &quot;is correct!&quot;, &quot;\033[0;30m&quot;)
        guessed_letters.append(guess)
        for i in range(0, length_word):
          if word[i] == guess:
            guessed_word[i] = guess
        print(guessed_word)
        if not &quot;_&quot; in guessed_word:
          print(&quot;\033[1;3;32m&quot;+&quot;Congratulations, you beat the Hangman!&quot;, &quot;\033[0;30m&quot;)
          break 

      elif guess not in word:
        wrong_guesses += 1
        print(print_graphics(wrong_guesses))
        print(guessed_word)
        print(&quot;\033[1;31m&quot;+guess.upper(), &quot;is not correct. You have&quot;, 6-wrong_guesses, &quot;guesses left&quot;, &quot;\033[0;30m&quot;)
        guessed_letters.append(guess)    
    if wrong_guesses == 6:
      print(&quot;\033[1;31m&quot;+&quot;Bad luck! You have been beaten by the Hangman. The word you were trying to guess was&quot;, word, &quot;\033[0;30m&quot;)
  



play(word)
print(&quot;\033[1;3;35m&quot;+&quot;Game over, thank you for playing :)&quot;)
You write

from termcolor import colored


but then ignore that and write non-portable escape sequences directly in the strings:

  print(&quot;\033[1;34m&quot;+&quot;....&quot;, &quot;\033[0;30m&quot;)


Doesn't that defeat the point of termcolor, which is supposed to adapt to the connected terminal?