Deck

a deck of playing cards

source

Deck

 Deck ()

Initialize self. See help(type(self)) for accurate signature.

When instanciate a Deck there are all cards present:

deck = Deck()
deck
A♣️; 2♣️; 3♣️; 4♣️; 5♣️; 6♣️; 7♣️; 8♣️; 9♣️; 10♣️; J♣️; Q♣️; K♣️; A♦️; 2♦️; 3♦️; 4♦️; 5♦️; 6♦️; 7♦️; 8♦️; 9♦️; 10♦️; J♦️; Q♦️; K♦️; A♥️; 2♥️; 3♥️; 4♥️; 5♥️; 6♥️; 7♥️; 8♥️; 9♥️; 10♥️; J♥️; Q♥️; K♥️; A♠️; 2♠️; 3♠️; 4♠️; 5♠️; 6♠️; 7♠️; 8♠️; 9♠️; 10♠️; J♠️; Q♠️; K♠️

Test Create New Deck…

deck = Deck()
test_eq(len(deck), 52)

Test the pop function…

deck = Deck()
test_eq(deck.pop(), Card(3,13))

test the remove function…


source

draw_n

 draw_n (n:int, replace:bool=True)

Draw n cards, with replacement iif replace

Type Default Details
n int number of cards to draw
replace bool True whether or not draw with replacement

simple test to see if the draw_n draws the correct number of cards

test_eq(len(draw_n(5)), 5)