Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 classStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started