class Card():
ranks = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
def __init__(self, rank, suit):
self.rank = rank
self.suit = suit
def __lt__(self, other):
return Card.ranks.index(self.rank) < Card.ranks.index(other.rank)
def __gt__(self, other):
return Card.ranks.index(self.rank) > Card.ranks.index(other.rank)
card1 = Card('2', 'clubs')
card2 = Card('K', 'diamonds')
print(card1 < card2)True