GH 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-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!

go back Advanced level
Bitecoin 4X

Will you be Pythonista #37 to crack this Bite?
Resolution time: ~55 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 3.33 on a 1-10 difficulty scale.
» You can do it! 😌

Buy Now Login and get coding
We use Python 3.7