from cards.deck import Deckcards
A minimal example of nbdev based on Allen Downey’s Think Python 2nd Ed
Install
pip install cardsHow to use
Create a Deck of standard playing cards:
deck = Deck()
deckA♣️ 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♠️
Decks work like ordinary Python lists. Draw a Card from the deck with deck.pop:
card = deck.pop()
cardK♠️