Giter Club home page Giter Club logo

cards_deck's Introduction

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♣️

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.