title: Why is the same card being drawn in this while loop for card deck?
body: <p>I have built a deck of cards in the following code. I'm running a while loop to try drawing cards from the deck, but the same card is repeatedly drawn for the entire length of the deck. Obviously, what I want is to draw a <em>different</em> card each time.</p>
  <p>What am I doing wrong?</p>
  <pre><code>import random
  
  
  class Card(object):
      def __init__(self, suit, value):
          self.suit = suit
          self.value = value
  
      def show(self):
          print(&quot;{} of {}&quot;.format(self.value, self.suit))
          return self.value
  
  
  class Deck(object):
      def __init__(self):
          self.cards = []
          self.build()
  
      def build(self):
          for s in [&quot;Spades&quot;, &quot;Clubs&quot;, &quot;Diamonds&quot;, &quot;Hearts&quot;]:
              for v in range(1, 14):
                  self.cards.append(Card(s, v))
                  #print(&quot;{} of {}&quot;. format(v, s))
  
      def show(self):
          for cards in self.cards:
              print(cards.show())
  
      def shuffle(self):
          random.shuffle(self.cards)
  
      def draw_card(self):
          return self.cards.pop()
  
  
  class Player(object):
      def __init__(self, name):
          self.name = name
          self.hand = []
  
      def draw(self, Deck):
          self.hand.append(Deck.draw_card())
          return self
  
      def show_hand(self):
          for card in self.hand:
              card.show()
              return card.value
  
  
  Computer = Player(&quot;Computer&quot;)
  deck = Deck()
  deck.shuffle()
  while len(deck.cards) &gt; 0:
      Computer.draw(deck)
      Computer.show_hand()
  </code></pre>