title: Typing game made in python (timer, multithreading, def(), etc
body: <pre><code>import random
  from threading import Timer
  
  class color:
     PURPLE = '\033[95m'
     CYAN = '\033[96m'
     DARKCYAN = '\033[36m'
     BLUE = '\033[94m'
     GREEN = '\033[92m'
     YELLOW = '\033[93m'
     RED = '\033[91m'
     BOLD = '\033[1m'
     UNDERLINE = '\033[4m'
     END = '\033[0m'
  
  score = 0
  
  list = ("Toothpaste", "Seashell", "Binder", "Computer", "Laptop", "Tablet", "Turing", "Python", "Circuit")
  list2 = ("Mathematics", "Onomatopoeia", "Obnoxious", "Archiving", "Licencing")
  
  endgame = 0
  
  def printbob():
      print("you lose bro")
      endgame = 1
  
  def boys():
      points = 0
      while(score &gt;= 0):
          timeout = 3
          timer = Timer(timeout, printbob)
          timer.start()
          if(points &lt; 5):
              cs = random.choice(list)
          else:
              cs = random.choice(list2)
          print("Type this sentence:", color.GREEN + cs + color.END)
          user = "You have %d seconds to choose the correct answer...\n" % timeout
          answer = input(user)
          timer.cancel()
          if (answer == cs) and (endgame == 0):
              print("Nice")
              points += 1
          else:
              print("Bye")
              exit()
  boys()
  </code></pre>
  
  <p>This is a program that prints an chosen word from a list, and requires the user to print the exact same word within the constrained time. However, the issue is that if no input is given, the code does not exit since it is waiting for an input. </p>
  
  <p>In short, how can I adjust my code so that the program exits when no input is given.</p>
  
  <p>Thanks,
  Robert Daniro</p>