example-code-2e/05-data-classes/cards.py

10 lines
208 B
Python
Raw Normal View History

2020-02-19 04:11:45 +01:00
from dataclasses import dataclass
@dataclass(order=True)
class Card:
rank: str
suit: str
ranks = [str(n) for n in range(2, 10)] + list('JQKA')
suits = 'spades diamonds clubs hearts'.split()