Objective
Practice basic object-oriented programming constructs by designing, testing, and using a class.
Procedure
Create a class called UnoCard that represents a single card from the classic Uno card game. You must include at least the following methods:
1. __init__(self, color, rank) (constructor): takes a color (string, one character of "RGBYK") and a rank (string, one of 0-9, S, D, R for the first 4 colors, and Wild or Draw Four for black).
2. can_be_played_on(self, other): takes another card and determines whether this card can be played on it, following standard rules (matches color or number/symbol, or is a Wild/Draw Four).
3. score_value(self): returns the value of this card at the end of the game (rank for number cards, 20 for Skip, Draw Two, and Reverse, and 50 for Wild/Draw Four cards).
4. __str__ and __repr__: return human-readable and Python-executable string representations of the card.
Write 3 global functions that perform the following actions:
1. create_deck(): returns a complete, shuffled Uno deck as a list of 108 UnoCard objects.
2. deal_hands(deck, num_hands): returns a tuple of num_hands lists of 7 cards dealt from deck, 1 to each hand at a time (not all 7 to a single hand consecutively). Removes the cards that were dealt from the "top" of the deck (starting at position 0).
3. hand_score(hand): takes a list of UnoCards and returns the total score for that hand.
Resources
Wikipedia page about the game