Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PYTHON: Write a function named poker2(hand,card) that randomly distributes cards to multiple players? Input parameter 'hand' means the number of hands/players, while 'card' means the
PYTHON:
Write a function named poker2(hand,card) that randomly distributes cards to multiple players?
- Input parameter 'hand' means the number of hands/players, while 'card' means the number of cards each player should have at the end of you distribution
- The product of 'hand' and 'card' must be less than or equal to 52, otherwise the game is invalid; in that case, your function should return the following communication, 'Please enter valid input parameters.'
- If the product of 'hand' and 'card' < 53, the function should return a list of lists. For example, an output of poker2(4,2) could be [['D13', 'H2'],['H5', 'H7'], ['H1', 'S11'], ['C1', 'D11']].
Background: A standard deck of playing cards consists of 52 Cards in 4 suits: Spades, Hearts, Diamonds, and Clubs. Each suit contains 13 cards: Ace (1), 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack (11), Queen (12), King (13). For simplicity, denote Club by C, Diamond D, Heart H, and Spade S; 1~13 (Jack = 11, Queen = 12, King = 13)
Step 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