title: Python 3 ValueError deleting from list
body: <p>I'm creating a new game using Python 3 and PySide. The game is a simple UI for the game Password, and basically pulls a random value from a list, displays it, and once done with the value(word), deletes said word from the list, as to not use it twice. The odd problem is that the GUI only allows 4 choosings of a words at a time, then throws a ValueError, saying that the list is empty, which is obviously false, seeing as you only go through 4 words before you get the error.</p>
  
  <pre><code>#!/usr/bin/python
  
  import sys
  from PySide import QtCore, QtGui
  from random import *
  
  from game_gui import Ui_main_window
  from game_list import cards
  
  
  
  
  class game_window(QtGui.QWidget, Ui_main_window):
      def __init__(self, parent=None):
          super(game_window, self).__init__(parent)
  
          self.setupUi(self)
  
          global password_label
          password_label = self.password_label
  
          global get_button
          get_button = self.get_button
          get_button.clicked.connect(self.button_clicked)
  
  
      def label_clear(self):
          password_label.setText('Push Button To Get New Word')
          get_button.setText('Push Me To Get A Word')
          get_button.clicked.connect(self.button_clicked)
  
      def button_rename(self):
          get_button.setText('Push To Clear Word')
          get_button.clicked.connect(self.label_clear)
  
  
      def button_clicked(self):
          card_to_play = choice(cards)
  
          password_label.setText(card_to_play)
          cards.remove(card_to_play)
          self.button_rename()
  
  
  if __name__ == "__main__":
      app = QtGui.QApplication(sys.argv)
      window = game_window()
      window.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>And the error is:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/lib/python3.3/random.py", line 249, in choice
      i = self._randbelow(len(seq))
    File "/usr/lib/python3.3/random.py", line 225, in _randbelow
      r = getrandbits(k)          # 0 &lt;= r &lt; 2**k
  ValueError: number of bits must be greater than zero
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "game_code.py", line 58, in button_clicked
      card_to_play = choice(cards)
    File "/usr/lib/python3.3/random.py", line 251, in choice
      raise IndexError('Cannot choose from an empty sequence')
  IndexError: Cannot choose from an empty sequence
  </code></pre>
  
  <p>And both those errors show up ~50 times.</p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>EDIT: As requested, here's the list.</p>
  
  <pre><code>cards = [
      'scripture',
      'miracle',
      'garment',
      'prophecy',
      'tomb',
      'staff',
      'spirit',
      'garden of eden',
      'heaven',
      'sulpher',
      'nephelim',
      'knowledge',
      'armageddon',
      'plague',
      'commandment',
      'sovereignty',
      'resurrection',
      'wine',
      'cherub',
      'sandals',
      'wilderness',
      'gehena',
      'famine',
      'temple',
      'passover',
      'baptism',
      'leprosy',
      'ark',
      'drachma',
      'pharaoh',
      'levites',
      'scroll',
      'chaff',
      'boils',
      'Holy Spirit',
      'dragon',
      'lots',
      'Babylon',
      'tent',
      'parable',
      'scales',
      'Urim &amp; Thummim',
      'scarlet',
      'transfiguration',
      'flame',
      'wild beast',
      'straw',
      'Red Sea',
      'pearl',
      'emerald',
      'swine',
      'demon',
      'Tartarus',
      'wine',
      'turtledove',
      'gnat',
      'camel',
      'garment',
      'shroud',
      'tomb',
      'Most Holy',
      'curtain,'
      'olive branch',
      'dust',
      'Cherub',
      'bull',
      'scorpion',
      'Nephilim',
      'privy',
      'sacrifice',
      'earthquake',
      'abyss',
      'fasting',
      'stake',
      'sling',
      'Samson',
      'Goliath',
      'betrayer',
      'slanderer',
      'murderer',
      'circumcision',
      'astrologer',
      'Hades',
      'chariot',
      'cistern',
      'balsalm',
      'undergarment',
      'bruise',
      'shipwreck',
      'fish',
      'intestines',
      'conscience',
      'curtain',
      'hypocrisy',
      'whitewash',
      'grave',
      'spear',
      'breastplate',
      'helmet',
      'leviathan',    
      ]
  </code></pre>