MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / getDeck

Function getDeck

src/gamesbyexample/blackjack.py:140–149  ·  view source on GitHub ↗

Return a list of (rank, suit) tuples for all 52 cards.

()

Source from the content-addressed store, hash-verified

138
139
140def getDeck():
141 """Return a list of (rank, suit) tuples for all 52 cards."""
142 deck = []
143 for suit in (HEARTS, DIAMONDS, SPADES, CLUBS):
144 for rank in range(2, 11):
145 deck.append((str(rank), suit)) # Add the numbered cards.
146 for rank in ('J', 'Q', 'K', 'A'):
147 deck.append((rank, suit)) # Add the face and ace cards.
148 random.shuffle(deck)
149 return deck
150
151
152def displayHands(playerHand, dealerHand, showDealerHand):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected