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

The Paw Patrol card deck consists of 32 cards ranging A1-A2..B1-B2..C..G..H3-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!

10 out of 10 users completed this Bite.
Will you be Pythonista #11 to crack this Bite?
Average Bite difficulty 1-10 rating: 3.0
» You can do it! 😌

Github login button
We use Python 3.7