Question: In python. Please write down the comment for each step. And please attach the screenshot of the program. Problem 2. Create a class for a

 In python. Please write down the comment for each step. And

please attach the screenshot of the program. Problem 2. Create a class

In python. Please write down the comment for each step. And please attach the screenshot of the program.

Problem 2. Create a class for a deck of cards'. The deck of cards should use another class, a 'card' class. . The Deck class should have a deal method to deal a single card from the deck. (Think of pop) . After a card is dealt, it is removed from the deck .There should be a shuffle method which makes sure the deck of cards has all 52 cards and then rearranges them randomly. The Card class should have a suit (Hearts, Diamonds, Clubs, ISpades) and a value (A,2,3,4,5,6,7,8,9,10,J,Q,K) When you issue the print(d1) command where d1 is of type Deck, the program should print the number of remaining cards in the deck. . . When you issue the print(d1, deal0) command i should deal a card and also display the value and suit of the card. Make sure your deck class defines the suits and values in the init method and creates a set of cards using the Card class

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 Databases Questions!