title: Why does my program stop responding and crashing?
body: <p>I was just trying to learn some PyGame which will be needed for my coming project so I would like to know why this sample piece of code is crashing and how I can fix it.</p>
  
  <p>I've tried looking online and haven't found a working solution.</p>
  
  <pre><code>import pygame
  
  # Initialise pygame
  pygame.init()
  clock = pygame.time.Clock()
  # pygame.font.init()
  myFont = pygame.font.SysFont('Comic Sans MS', 30)
  
  # Colours
  BLACK = (0,   0,   0)
  WHITE = (255, 255, 255)
  BLUE  = (0,   0, 255)
  GREEN = (0, 255,   0)
  RED   = (255,   0,   0)
  
  # Screen Size
  size = [400, 300]
  screen = pygame.display.set_mode(size)
  
  # Initialise Variables
  done = False
  
  class Unit:
      def __init__(self, name, hp, attack):
          self.name = name
          self.hp = hp
          self.attack = attack
  
  class Infantry(Unit):
      def __init__(self, name, hp, attack):
          super().__init__(name, hp, attack)
  
      def attack_turn(self):
          self.hp -= self.attack
          text_surface = myFont.render(self.name + " has " + str(self.hp) + " health points left!", True, (255, 0, 0))
          screen.blit(text_surface, (0, 0))
          # print(self.name + " has " + str(self.hp) + " health points left!")
          x = input("Press ENTER to continue!")
  
  player = Infantry("Panzer", 110, 13)  # The attack set here is for the enemy.
  enemy = Infantry("T-14", 100, 30)  # The attack set here is for the player.
  
  while not done:
  
      for event in pygame.event.get():
          if event.type == pygame.QUIT:
              done = True
      while player.hp &gt; 0 and enemy.hp &gt; 0:
          player.attack_turn()
          enemy.attack_turn()
  
      done = True
  
  if player.hp &gt; enemy.hp:
      # print(player.name + " wins!")
      text_surface = myFont.render(player.name + " wins!", False, (255, 0, 0))
      screen.blit(text_surface, (100, 100))
  else:
      # print(enemy.name + " wins!")
      text_surface = myFont.render(enemy.name + " wins!", False, (255, 0, 0))
      screen.blit(text_surface, (100, 100))
  </code></pre>
  
  <p>I hoped that the code would at least run so I could work off there but it's not even doing that.</p>