Skip to main content

About Blackjack

Objective

Having a higher sum than the dealer's hand.

Card Values

  • Numeric cards (2-10): The value is as indicated by the number shown.
  • Face cards (Jack, Queen, King): Each has a value of 10.
  • Ace: Can be set to either 1 or 11.

Game Flow

  • Deal the cards
    • The player and the dealer are each dealt two cards. The player's cards are both face up, while the dealer's is one face up and the other face down.
  • Player's Choice
    • Hit: Draw another card.
    • Stand: Play with the current hand.
  • Dealer's Turn
    • The dealer turns the face-down cards face up and draws cards until he has 17 or more.
  • Winner Decides
    • If the total hand exceeds 21, then loses on a “bust”.
    • When the dealer busts, the remaining player wins.
    • If the hand is high, then wins.
    • If the hands are the same, then tie.

Install

pip install blackjackpy

How to play

$ blackjackpy
Player( 6):  2(C) 4(S)
Dealer(--):  5(C) *(*)
Hit? (y/n) y
Player(16):  2(C) 4(S) J(C)
Dealer(--):  5(C) *(*)
Hit? (y/n) n
Player(16):  2(C) 4(S) J(C)
Dealer(17):  5(C) 3(C) 9(S)
You lose.
$ blackjackpy
Player(20): 10(S) K(C)
Dealer(--):  7(C) *(*)
Hit? (y/n) n
Player(20): 10(S) K(C)
Dealer(18):  7(C) A(H)
You win.

Metadata

Release files for blackjackpy 0.4.1

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

Built distribution (wheel)

Table of built distributions (wheels) for blackjackpy 0.4.1
File Interpreter ABI Platform Actions
blackjackpy-0.4.1-py3-none-any.whl Python 3 none any Details for blackjackpy-0.4.1-py3-none-any.whl

Release files / blackjackpy-0.4.1-py3-none-any.whl

Download URL blackjackpy-0.4.1-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b152fa3fd906c70443d1a21372c3c363d9cd3dc6d0761937661d993b24ad34ef
BLAKE2b-256 checksum
How to use checksums
4dd4b0e531dd4c0088a275d7b21a5a150f36d0fb8ef8a0cc7d4d7f03f8de8169
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for blackjackpy 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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