Question: Create a class called CardDeck with a standard 5 2 - card deck of playing cards ( or several of them ) , with methods

Create a class called CardDeck with a standard 52-card deck of playing cards (or several of them), with methods deal(), deal_random(), shuffle(), count(), dealt(), undealt() as specified below. The class must include:
Object Data:
cards - list of Card objects
top - index of last card dealt (undealt cards have index < deck.top)
Methods:
CardDeck(n)- new deck with 52*n cards (n defaults to 1)
shuffle()- replace any dealt cards and randomize the deck's order
deal()- take off the top card (and return it)
deal_random()- take an undealt card from a random spot in the deck
count()- total number of cards (52*n)
dealt()- number of cards that have been dealt since last shuffle
undealt()- number of cards that have yet to be dealt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!