avatar Bite 61. Create a variable size Paw Patrol card deck with random actions

The Paw Patrol card deck consists of 32 cards ranging A1–A4 ... B1–B4 ... G1–G4 ... H1–H4.

8 of these cards have an action associated: 2x draw_card, 2x play_again, 2x interchange_cards, 2x change_turn_direction which are defined in ACTIONS.

So for each 4 cards one gets an action assigned. For this exercise you will assign them randomly. For this Bite complete create_paw_deck generating the deck.

To make it a bit more challenging it will receive an input argument n which determines the letters used in the deck:

  • the default is 8 letters (card range A1-H4),
  • n=16 would give you card range A1..P4,
  • n=26 gives you card range A1..Z4,
  • if n > 26 raise a ValueError.
  • as you see the number part of the card is always 1..4 (NUMBERS).

The function returns a list of PawCard namedtuple objects. Make sure that the right amount of actions get assigned to the cards (again the ratio = 1/4) and that they are randomly distributed. The tests check for this.

Good luck and have fun!

Login and get coding
go back Advanced level
Bitecoin 4X

103 out of 103 users completed this Bite.
Will you be the 104th person to crack this Bite?
Resolution time: ~58 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 4.14 on a 1-10 difficulty scale.
» Up for a challenge? 💪

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help