An example repository for nbdev
Project description
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♣️
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cards-deck-0.0.3.tar.gz.
File metadata
- Download URL: cards-deck-0.0.3.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8032e0e95467130a4b4f034d3af62420b014662bbd4270b2d18a85f78e7ebeb1
|
|
| MD5 |
729f4fafee75cb7b80c12b57ca9e104b
|
|
| BLAKE2b-256 |
cc3b37b02843b8a8d553944e9706e0572f4f66bacfc3ed9bc93d06c5a78c057a
|
File details
Details for the file cards_deck-0.0.3-py3-none-any.whl.
File metadata
- Download URL: cards_deck-0.0.3-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3f011626c106b43eff429960a4adddc00376fc22d3de7896c8e3217afc4e5ad
|
|
| MD5 |
c38e51aad37ec63b4f939cb2f01d79d5
|
|
| BLAKE2b-256 |
d141846245bbc4bb2b4924828c6164ce007c45d3428251429a361ca297c3697e
|