Deck of Cards

Define a deck of playing cards

Lets define a deck of cards!


source

Deck

 Deck ()

A deck of 52 cards, not including jokers

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♠️

Our deck should have 52 cards:

assert len(deck) == 52

source

Deck.pop

 Deck.pop (idx:int=-1)

Remove one card from the deck

Type Default Details
idx int -1 The index of the card to remove, defaulting to the last one

You can remove a card from the deck like so:

deck.pop()
Q♠️