I am currently trying to make a hangman game. I have defined the variable 'lives' outside any functions, yet when trying to use it inside the start_game function the editor says that the variable is defined but never used. However when I try to declare it as global, whether it be inside or outside the function, it gives me an 'invalid syntax' error- specifically at the assignment operator '='.
import random
words = "dog cat log hog etc"     # <-- just a huge string of a bunch of words
words = words.split()
word = random.choice(words)
# Difficulties: Easy:12 Medium:9 Hard:6
lives = 0
current = "_" * len(word)
def gameLoop():
  while current != word and lives > 0:
    print("Guess a letter. If you wish to exit the game, enter 'exit'")
    input("")
    print(lives)
def start_game():
  while True:
    print("Welcome to Hangman! What game mode would you like to play? Easy, medium, or hard?")
    game_mode = str.lower(input(""))
   if game_mode == "easy":
      lives = 12
      gameLoop()
      break
    elif game_mode == "medium":
      lives = 9
      gameLoop()
      break
    elif game_mode == "hard":
      lives = 6
      gameLoop()
      break
start_game()
 
    