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.3.tar.gz (9.1 kB view hashes)

Uploaded Source

Built Distribution

cards_deck-0.0.3-py3-none-any.whl (9.1 kB view hashes)

Uploaded Python 3

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