This repo uses code based on Allen Downey’s ThinkPython2.
After cloning this repository:
pip install -e .
Caution
This project is an example of how to create python packages with nbdev. It’s not a fully-fledged card dealing library!
Playing cards in python!
from cards_deck.deck import Deck
d = Deck()
print(f'Number of playing cards in the deck: {len(d)}')
Number of playing cards in the deck: 52
card = d.pop()
card, len(d)
(K♠️, 51)
See the docs for more info.
We included a handy cli you can use to draw cards as well!
!draw_cards -h
usage: draw_cards [-h] [--replace] [--outfile OUTFILE] n
Draw `n` cards optionally with replacement
positional arguments:
n number of cards to draw
optional arguments:
-h, --help show this help message and exit
--replace whether or not draw with replacement (default: False)
--outfile OUTFILE output file, defaults to stdout
!draw_cards 10
5❤️
6❤️
10♠️
4♣️
A♣️
A❤️
9❤️
4❤️
K❤️
3♣️