title: Why is my program crashing when at least 1 of 4 list becomes empty?
body: <p>I am creating the card game 'war' in python. In war you divide up all 52 cards to the players. The problem that I am having is when one suit list becomes empty, it crashes the program. I have tried to solve it by saying that <code>suit = random.choice(poss_suits)</code>, after <code>except IndexError:</code>, but that didn't work. Any ideas?</p>
  <pre><code>Diamonds = ['Ace', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King']
  Hearts = ['Ace', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King']
  Spades = ['Ace', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King']
  Clubs = ['Ace', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King']
  
  poss_suits = [Diamonds, Hearts, Spades, Clubs]
  </code></pre>
  <pre><code>player_deal = 52
  while player_deal &gt; 0:
      try:
          suit = random.choice(poss_suits)
  
          if suit == Diamonds:
              card = random.choice(Diamonds)
              Diamonds.remove(card)
  
          if suit == Hearts:
              card = random.choice(Hearts)
              Hearts.remove(card)
  
          if suit == Spades:
              card = random.choice(Spades)
              Spades.remove(card)
  
          if suit == Clubs:
              card = random.choice(Clubs)
              Clubs.remove(card)
  
          Player.hand.append(card)
          player_deal -= 1
      except IndexError:
  </code></pre>