''' DS2000 Spring 2022 Deck class to play a game of cards ''' import random from card import Card DEF_VALUES = [i for i in range(2, 15)] DEF_SUITS = ["Clubs", "Diamonds", "Hearts", "Spades"] class Deck: def __init__(self, values = DEF_VALUES, suits = DEF_SUITS): ''' make a deck object with the given values and suits ''' self.cards = [] for value in values: for suit in suits: c = Card(value, suit) self.cards.append(c) self.shuffle() def shuffle(self): ''' shuffle the deck of cards ''' for i in range(len(self.cards)): r = random.randint(0, len(self.cards) - 1) self.cards[i], self.cards[r] = self.cards[r], self.cards[i] def draw(self): ''' return a card at the end of the deck and remove it ''' return self.cards.pop()