Skip to main content

deck_of_cards

A module to create a deck of cards object with which you can interact.

Documentation

https://deck-of-cards.readthedocs.io/en/latest/

Example usage

import the module from deck_of_cards import deck_of_cards

create an instance of DeckOfCards deck_obj = deck_of_cards.DeckOfCards()

add jokers deck_obj.add_jokers()

sort the deck by card value

deck_obj.order_deck()
print("\nDeck sorted\n")
deck_obj.print_deck()

give out a random card card = deck_obj.give_random_card()

card objects have the following attributes

card.suit  # 0=spades, 1=hearts, 2=diamonds, 3=clubs, 4=joker
card.rank  # 1=Ace, 11=Jack, 12=Queen, 13=King, 14=B&W Joker, 15=Color Joker
card.value # defaults: same as rank
card.name  # string representation
card.image_path = ""  # path to an image file corresponding to the card

insert a new card into the deck

print(len(deck_obj.deck))
card = deck_of_cards.Card((2, 11))
print(card.name)
deck_obj.take_card(card)
print(len(deck_obj.deck))

shuffle the deck

deck_obj.shuffle_deck()
print("\nDeck shuffled\n")
deck_obj.print_deck()

add a second deck of cards to the first one

print(len(deck_obj.deck))
deck_obj.add_deck()
print(len(deck_obj.deck))

Test coverage

============================= test session starts =============================
platform win32 -- Python 3.5.3, pytest-3.6.2, py-1.5.3, pluggy-0.6.0
rootdir: C:\Users\Smoky05\PycharmProjects\deck_of_cards, inifile:
plugins: cov-2.5.1
collected 12 items

deck_of_cards\test_deck_of_cards.py ............                         [100%]

----------- coverage: platform win32, python 3.5.3-final-0 -----------
Name                             Stmts   Miss  Cover
----------------------------------------------------
deck_of_cards\deck_of_cards.py     131     29    78%


========================== 12 passed in 0.15 seconds ==========================

Metadata

Release files for deck-of-cards 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deck-of-cards 0.0.10
File Size Uploaded
deck_of_cards-0.0.10.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for deck-of-cards 0.0.10
File Interpreter ABI Platform
deck_of_cards-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / deck_of_cards-0.0.10.tar.gz

Download URL deck_of_cards-0.0.10.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f66cea62d87c650a602f1f1aa78444b0ea5e54dc0c36f21771dc47ad933942c9
BLAKE2b-256 checksum
How to use checksums
afb4efbe681c505308bd1ea9331ffadc32a8468a9a8ce1c3717adbc851a43b6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

Release files / deck_of_cards-0.0.10-py3-none-any.whl

Download URL deck_of_cards-0.0.10-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76bf77c1b752c337bcb6dd2350c9d249fc0ed8ccf07a4255049514e9fd166635
BLAKE2b-256 checksum
How to use checksums
77e63dcb4a79adccf906e34ec0fc2564ac06a54a399fbc69508f39733a1c29a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page