Dealing hands X94344


Statement
 

pdf   zip   main.py

html

Using the Card, Deck, and Hand class definitions, write a Deck method named deal_hands that takes two parameters: the number of hands and the number of cards per hand. It should create the appropriate number of Hand objects, deal the appropriate number of cards per hand, and return a list of Hands.

Input

The input consist of two non-negative integers, the number of hands and the number of cards per hand, followed by a shuffled deck of cards.

Output

Print the cards in each hand followed by a blank line.

Precondition

The number of cards in the shuffled deck is not less than the number of hands times the number of cards per hand.

Public test cases
  • Input

    2
    5
    King of Hearts
    Jack of Hearts
    8 of Clubs
    7 of Diamonds
    8 of Hearts
    Jack of Clubs
    Queen of Diamonds
    6 of Clubs
    2 of Diamonds
    King of Spades
    8 of Spades
    Jack of Diamonds
    

    Output

    Jack of Diamonds
    8 of Spades
    King of Spades
    2 of Diamonds
    6 of Clubs
    
    Queen of Diamonds
    Jack of Clubs
    8 of Hearts
    7 of Diamonds
    8 of Clubs
    
    
  • Information
    Author
    Gabriel Valiente
    Language
    English
    Official solutions
    Python
    User solutions
    Python