We will be using numbers to represent playing card clubs and ranks. These are the suits
[None, 'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
Comparison operators
equality, less than, and greater than work on the rank and suit indices:
source
Card
Card (suit:int, rank:int)
A playing card
test_eq(Card(suit=1, rank=3), Card(suit=1, rank=3))
test_ne(Card(suit=2, rank=3), Card(suit=1, rank=3))
test_ne(Card(suit=1, rank=2), Card(suit=1, rank=3))
assert Card(suit=1, rank=3)<Card(suit=2, rank=3)
source