
class Card:
    """
    Class defining a standard playing card object which has attributes corresponding
    to both rank and suit. Also exports several class variables for convenience 
    corresponding to the numeric suit ranks, which can be accessed, for example,
    as Card.CLUB or Card.HEART.
    """
    CLUB = 0
    DIAMOND = 1
    HEART = 2
    SPADE = 3

    def __init__(self, rank, suit):
        """
        Creates a new card object.

        Inputs:
            rank (int): value between 1 and 13 corresponding to Ace -- King
            suit (int): a value between 0 and 3 corresponding to suit
        """
        self.rank = rank
        self.suit = suit

    def __repr__(self):
        """ Displays a single card using human-readable symbols. """
        rank_symbols = "A23456789TJQK"
        #unicode hex values for suit symbols
        suit_symbols = [0x2663, 0x2666, 0x2665, 0x2660] 
        return rank_symbols[self.rank-1] + chr(suit_symbols[self.suit])

    def get_rank(self):
        """ Returns the numeric rank of a card, between 1 and 13, inclusive. """
        return self.rank

    def get_suit(self):
        """ Returns the numeric suit of a card, between 0 and 3, inclusive. """
        return self.suit


if __name__ == '__main__':
    C = Card(12,2)
    print(C.get_rank())
    print(C.get_suit())
    print(C)
