Deck of Cards
This repo uses code based on Allen Downey’s ThinkPython2.
Install
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!
How to use
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.
The draw_cards cli:
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♣️
Release files for cards-deck 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cards-deck-0.0.3.tar.gz | 9.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cards_deck-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.2 kB
Release files / cards-deck-0.0.3.tar.gz
| Download URL | cards-deck-0.0.3.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8032e0e95467130a4b4f034d3af62420b014662bbd4270b2d18a85f78e7ebeb1
|
|
BLAKE2b-256 checksum How to use checksums |
cc3b37b02843b8a8d553944e9706e0572f4f66bacfc3ed9bc93d06c5a78c057a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / cards_deck-0.0.3-py3-none-any.whl
| Download URL | cards_deck-0.0.3-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3f011626c106b43eff429960a4adddc00376fc22d3de7896c8e3217afc4e5ad
|
|
BLAKE2b-256 checksum How to use checksums |
d141846245bbc4bb2b4924828c6164ce007c45d3428251429a361ca297c3697e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|