Question: 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?

  1. 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
  2. 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.'
  3. 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

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!