Playing cards.

class Deck[source]

Deck()

Represents a deck of cards. Attributes: cards: list of Card objects.

A Deck of cards is a collection of MyCard objects:. For example:

deck = Deck()
assert isinstance(deck.pop_card(), MyCard)

Deck.remove_card[source]

Deck.remove_card(card)

Removes a card from the deck or raises exception if it is not there.

card: MyCard

You can do comparisons of cards, too!

card23 = MyCard(2, 3)
deck.remove_card(card23)

assert card23 not in deck.cards
c = MyCard(2,10)
assert c in deck.cards
c
10 of Hearts