Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cards-deck-0.0.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

cards_deck-0.0.2-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file cards-deck-0.0.2.tar.gz.

File metadata

  • Download URL: cards-deck-0.0.2.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

Hashes for cards-deck-0.0.2.tar.gz
Algorithm Hash digest
SHA256 286cc802536221c821eed7eb6a1021ba857231bd847c8ef828461cfb09455f7f
MD5 3618abec753053871f3ce0715ae177b1
BLAKE2b-256 a0775f6a19685291a1edcdb697a310e97f9d3f00b20d8ed35791523b221ff401

See more details on using hashes here.

File details

Details for the file cards_deck-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: cards_deck-0.0.2-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

Hashes for cards_deck-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ccfb97e8ab188cb9d1e4c3e7d191d4a6c0640bf30b15109ecf271797f403a64c
MD5 ad26bbd454cc1457b0976870200dc780
BLAKE2b-256 8f57f444aeb3c23325b1bcd2870d759e1956b3e3a7199c0e753bf92af7c49e6a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page