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