summaryrefslogtreecommitdiffstats
path: root/flashcards-project/src/flashcards/card.py
blob: 327834326c23eab090f90e96a07497be76c18f7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
"""
Defines a struct representing a single card. The struct takes the form:

(front, back)
"""
from collections import namedtuple
from hashlib import md5

Card = namedtuple('Card', ['front', 'back'])

def getId(card: Card) -> str:
    return md5((card.front + card.back).encode("utf-8")).hexdigest()