Question: Everything in python. I'm very unsure how to start this, any help would be great. A pack of playing cards has four suits, 'H', 'D',
Everything in python. I'm very unsure how to start this, any help would be great.


A pack of playing cards has four suits, 'H', 'D', 'S and 'C' (Hearts, Diamonds, Spades and Clubs) and a value 1 through 13 making a total of 52 cards. The following symbols map to the following values: A-1, 2-2, 3-3, 4-4,5-5.6-6, 7-7, 8-8, 9-9, 10-10, J-11. Q-12, K-13 (with A being the Ace. J being the Jack, Q being the Queen and K being the King). The suit a card belongs to does not affect its value, so, 2H and 25 both have the value of 2. On the other hand, QH has a higher value of 12 compared to AH that has a value of 1. You are required to design and implement an ADT named card. A card is a data structure that carries out some operations on a pack of cards. Each card itself will be stored as a string, with a numeric value preceding a letter (ex: "JD' for the jack of diamonds, '5H' being the 5 of hearts, etc). The card ADT has 6 operations: Card.create() Creates and returns a list of all possible cards that can be drawn from the 52 card playing deck. That is, all possible combinations of the suits of cards ['H', 'D'S'C') and the values 1 through 13 (but using A as 1, J as 11, Q as 12, Kas 13). print( Card.create()) # ["AH","2H","31", "4H","51", "6","71","8H","9","10","JH", "QH","KH",...] # Repeated for the 3 other suits (D,S,C) Card.deal (num_cards, num_players, deck) Randomly deals a number of cards to a number of play- ers from the given deck (list of card strings). When a card is drawn, it is removed from the deck dealo returns each player's hand as a list of lists. It is up to you to decide what happens if the deck runs out of cards before all players have been dealt all of their cards. cards_dealt Card. deal(5, 3, deck) print(cards_dealt) # [["50","10H", "QS","8C","JH"], [" JC","2H","8D","AS", "90"], # ["7H","6H","9","103","8H"]]. = # Card.value (card) Takes in the string of a card, and returns its integer value. Remember, its suit does not affect its value. Also remember that A-1, J-11, Q-12, K-13. For example, Card.value("KS") returns 13, and Card.value("4D") returns 4. Card.highest (list_of_cards) Takes a list of cards, and returns the the card string with the highest value. For example: highest-card = Card.highest (["50","10H", "QS","8C","JH"]) print (highest-card) # outputs: "QS" Card. lowest(list_of_cards) Takes a list of cards, and returns the string with the lowest value. For example: lowest_card Card.lowest(["50","10H", "QS","8C","JH"]) print(lowest_card) # outputs: "50" = Card. average (list_of_cards) Takes a list of cards, and returns the average (float) value of this given list of cards. average Card. average (["50","10H","QS","80","JH"]) # Will compute the average for: 5, 10, 12, 8, 11 print (average) # outputs: 9.2 Testing Write a test script that tests your implementation of the ADT, and ensures that all operations are correct. Think about the same kinds of issues: White-box test cases. Black-box test cases. Boundary test cases, and test case equivalence classes. Test coverage, and degrees of testing. Unit vs. Integration testing. Running your test script on your correct ADT should report no errors, and should display nothing except the message '*** Test script completed ***
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
