Deck
Deck is an implementation of the deck collection type, commonly confused with collections.deque.
>>> from deck import Deck
>>> d = Deck()
>>> d.shuffle()
>>> d.deal()
Card(<Suit.Diamonds: '♦'>, <Value.Two: 2>)
>>> d.deal()
Card(<Suit.Diamonds: '♦'>, <Value.Three: 3>)
>>> d.deal()
Card(<Suit.Hearts: '♥'>, <Value.Ten: 10>)
>>> d.deal()
Card(<Suit.Diamonds: '♦'>, <Value.Nine: 9>)
Deck supports cheating, if that's how you want to play.
>>> d.deal_from_bottom()
Card(<Suit.Spades: '♠'>, <Value.Five: 5>)
Importing the deck module also globally corrects other typographical errors that may occur in your code.
>>> import deck
>>> from collections import deck
>>> deck
<class 'deck.Deck'>
Taking this module too seriously would be a mistake.
However, if you want to use it to write a Poker game, the get_poker_hand function will help.
>>> from deck import Deck, get_poker_hand
>>> d = Deck(include_jokers=False)
>>> d.shuffle()
>>> p1 = [d.deal() for _ in range(5)]
>>> p2 = [d.deal() for _ in range(5)]
>>> if get_poker_hand(p1) > get_poker_hand(p2):
... print("Player 1 wins!")
...
Release files for deck 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deck-3.0.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deck-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / deck-3.0.0.tar.gz
| Download URL | deck-3.0.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
701a74566951ca3dd7a6c0bc6b45a348060cfae7e2093a1bf814417632daa896
|
|
BLAKE2b-256 checksum How to use checksums |
c197eb3d672139350610366fe274782e64238c93d2b16fc70519aa04e0591f1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.27.1
|
Release files / deck-3.0.0-py3-none-any.whl
| Download URL | deck-3.0.0-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6df7a9743d55ebd1fc21fed77a1b8a52c274ed90cb40232ec61352ce7bbe5010
|
|
BLAKE2b-256 checksum How to use checksums |
1fa1abe4fd1d3c88a01bce4afcb59eaf481b815b5400d1763653eb47afef6f51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.27.1
|