Question: by python INSTRUCTIONS: All problems must be developed using Python 3.x. 1. (40XP): Create a module cards.py that contains two classes Card and Deck. The

by python INSTRUCTIONS: All problems must be developed using Python 3.x. 1.(40XP): Create a module cards.py that contains two classes Card and Deck.by python

INSTRUCTIONS: All problems must be developed using Python 3.x. 1. (40XP): Create a module cards.py that contains two classes Card and Deck. The Card and Deck classes are general purpose for developing card games. Write code to test the Card and Deck classes as follows # To perform testing on a mod le, # you can write lines of code after the foilowing statement if _name.- == , main--' -- # write test here, for eample x=2 print (x) CARDS Each Card has two primary attributes: rank and suit. In an English deck, there are four suits -spades, diamonds, hearts, and clubs-that we represent by their first letters: 'S', 'D', 'H', 'C'. Each suit has thirteen cards-ace, 2-10, jack, queen, and king-with ranks 1-13, in that order. Each card has a value that for most cards is the same as its rank, but for face cards (jack, queen, king), the value is 10. The primary methods for the Card class are: get.rank returns the rank of a card (int) . get suit returns the suit of a card (string) get-value returns the value of a card (int) DECK A Deck is a collection of cards; in fact it is a sequence, because we expect a deck to be ordered. The primary methods for the Deck class are: * shuffle() randomly rearranges the cards in the deck (returns nothing) deal() returns one card and removes the card from the deck (Card) is-empty() returns True if there are no cards in the deck (bool) _len_.() returns the size of the Deck

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!