Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

# Question: A regular deck contains 52 cards. There are 4 suits: Hearts, Diamonds, Spades and Clubs There are 13 ranks: Ace, King, Queen, Jack, 10, 9,...

Question:A regular deck contains 52 cards.

• There are 4 suits: Hearts, Diamonds, Spades and Clubs
• There are 13 ranks: Ace, King, Queen, Jack, 10, 9, 8, 7, 6, 5, 4, 3, 2.

Create two classes, Card and Deck.

Class Card

Card is meant to represent a single card. The main function is to store the rank and value of the card and compare them using the following symbols

• " < "
• " == "
• " > "
• " >= "
• " <= "
• " != "

There are multiple ways to compare the cards, use this order:

• Suits: Clubs (lowest), followed by Diamonds, Hearts, and Spades (highest)
• Ranks: Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King (from smallest to highest).

(Hint: use a list/dictionary to assign values).

For example: King of Clubs is smaller (<) than 2 of Spades. First you compare Suits, and, if the same, you compare Ranks.

:'''This class represents a single cardAlso compares two cardsc1 = card(4, "Clubs")print(c1)4 of Clubsc2 = card(3, "Hearts")print(c2)3 of Heartsc1 < c2Truec1 > c2Falsec1 == c2False'''

The tests above show only three comparison operators: "<", ">" and "==". There should be appropriate methods for all of them.

Once you have finished creating Card class, you can move on to a Deck class.

Deck will contain

• __init__ - a constructor that will initialize a new Deck object. This will contain
• An instance variable called deck, which will be a deck of cards as a list (initially full).
• Deck should be initialized in sorted order by suit and card value. The suit order is Clubs, Diamonds, Hearts, and then Spades. Aces are low and can be treated as the number 1.
• An instance variable called dealt_cards, which will be a list of cards that have been dealt out
• shuffle() - a method that will be used to add dealt_cards back into deck and then shuffle the deck
• This should use the numpy function random choice exactly once. Documentation here. Think about the proper parameters here: what is a? what is the sizeand what is the value for replace?
• Note: in order to grade your assignment, we should make the random generator "predictable", so you all will get the same answer. In order to do that the special method, seed(), is used. Here is a link for more detailed explanation: seeding. This will make it so that each time you call random, you will get the same output.
• Note 2: Make sure to convert the numpy array back into a list after shuffling it with choice.
• deal_cards() - a method that will take in n and will deal out n cards from the top of the deck.
• The top n cards should be removed from deck and added to dealt_cards
• You will return the list of cards that were dealt.

REFER TO STARTER CODE DOCTESTS FOR OUTPUTS. Be sure to match everything.

Constructor's doctests: