Решение на Тесте карти от Петър Камбуров

Обратно към всички решения

Към профила на Петър Камбуров

Резултати

  • 10 точки от тестове
  • 0 бонус точки
  • 10 точки общо
  • 16 успешни тест(а)
  • 0 неуспешни тест(а)

Код

class Rank:
symbol = ''
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Suit:
color = ''
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Two(Rank):
symbol = '2'
class Three(Rank):
symbol = '3'
class Four(Rank):
symbol = '4'
class Five(Rank):
symbol = '5'
class Six(Rank):
symbol = '6'
class Seven(Rank):
symbol = '7'
class Eight(Rank):
symbol = '8'
class Nine(Rank):
symbol = '9'
class Ten(Rank):
symbol = '10'
class Jack(Rank):
symbol = 'J'
class Queen(Rank):
symbol = 'Q'
class King(Rank):
symbol = 'K'
class Ace(Rank):
symbol = 'A'
class Spades(Suit):
color = "black"
class Diamonds(Suit):
color = "red"
class Hearts(Suit):
color = "red"
class Clubs(Suit):
color = "black"
RANKS = {'Two': Two, 'Three': Three, 'Four': Four, 'Five': Five, 'Six': Six,
'Seven': Seven, 'Eight': Eight, 'Nine': Nine, 'Ten': Ten,
'Jack': Jack, 'Queen': Queen, 'King': King, 'Ace': Ace}
SUITS = {'Spades': Spades, 'Diamonds': Diamonds, 'Hearts': Hearts,
'Clubs': Clubs}
class Card:
def __init__(self, rank, suit):
self.__rank = rank()
self.__suit = suit()
def __eq__(self, other):
return self.rank == other.rank and self.suit == other.suit
def __str__(self):
return str(self.rank) + " of " + str(self.suit)
def __repr__(self):
return "<" + str(self.rank) + " of " + str(self.suit) + ">"
@property
def rank(self):
return self.__rank
@property
def suit(self):
return self.__suit
class CardCollection:
def __init__(self, collection=[]):
self.collection = [card for card in collection]
def __getitem__(self, index):
return self.collection[index]
def __len__(self):
return len(self.collection)
def __str__(self):
return str(self.collection)
def __repr__(self):
return str(self.collection)
def add(self, card):
self.collection.append(card)
return self
def draw(self, index):
return self.collection.pop(index)
def draw_from_top(self):
return self.collection.pop(len(self) - 1)
def draw_from_bottom(self):
return self.collection.pop(0)
def top_card(self):
return self.collection[-1]
def bottom_card(self):
return self.collection[0]
def index(self, card):
return self.collection.index(card)
def StandardDeck():
ALL_RANKS = "King Queen Jack Ten Nine Eight Seven Six Five Four Three\
Two Ace".split()
ALL_SUITS = "Diamonds Clubs Hearts Spades".split()
standart_cards = [Card(RANKS[rank], SUITS[suit]) for suit in ALL_SUITS
for rank in ALL_RANKS]
return CardCollection(standart_cards)
def BeloteDeck():
EXCLUDED_RANKS = "Six Five Four Three Two".split()
belot_cards = [card for card in StandardDeck()
if str(card.rank) not in EXCLUDED_RANKS]
return CardCollection(belot_cards)
def SixtySixDeck():
EXCLUDED_RANKS = "Eight Seven".split()
return [card for card in BeloteDeck()
if str(card.rank) not in EXCLUDED_RANKS]

Лог от изпълнението

................
----------------------------------------------------------------------
Ran 16 tests in 0.019s

OK

История (5 версии и 4 коментара)

Петър обнови решението на 24.03.2014 01:28 (преди над 10 години)

+class Rank:
+ def __init__(self, symbol):
+ self.symbol = symbol
+
+ def __eq__(self, other):
+ return self.__class__.__name__ == other.__class__.__name__
+
+ def __str__(self):
+ return self.__class__.__name__
+
+
+class Suit:
+ def __init__(self, color):
+ self.color = color
+
+ def __eq__(self, other):
+ return self.__class__.__name__ == other.__class__.__name__
+
+ def __str__(self):
+ return self.__class__.__name__
+
+
+class Two(Rank):
+ def __init__(self):
+ Rank.__init__(self, "2")
+
+
+class Three(Rank):
+ def __init__(self):
+ Rank.__init__(self, "3")
+
+
+class Four(Rank):
+ def __init__(self):
+ Rank.__init__(self, "4")
+
+
+class Five(Rank):
+ def __init__(self):
+ Rank.__init__(self, "5")
+
+
+class Six(Rank):
+ def __init__(self):
+ Rank.__init__(self, "6")
+
+
+class Seven(Rank):
+ def __init__(self):
+ Rank.__init__(self, "7")
+
+
+class Eight(Rank):
+ def __init__(self):
+ Rank.__init__(self, "8")
+
+
+class Nine(Rank):
+ def __init__(self):
+ Rank.__init__(self, "9")
+
+
+class Ten(Rank):
+ def __init__(self):
+ Rank.__init__(self, "10")
+
+
+class Jack(Rank):
+ def __init__(self):
+ Rank.__init__(self, "J")
+
+
+class Queen(Rank):
+ def __init__(self):
+ Rank.__init__(self, "Q")
+
+
+class King(Rank):
+ def __init__(self):
+ Rank.__init__(self, "K")
+
+
+class Ace(Rank):
+ def __init__(self):
+ Rank.__init__(self, "A")
+
+
+class Spades(Suit):
+ def __init__(self):
+ Suit.__init__(self, "Spades")
+
+
+class Diamonds(Suit):
+ def __init__(self):
+ Suit.__init__(self, "Diamonds")
+
+
+class Hearts(Suit):
+ def __init__(self):
+ Suit.__init__(self, "Hearts")
+
+
+class Clubs(Suit):
+ def __init__(self):
+ Suit.__init__(self, "Clubs")
+
+RANKS = {'Two': Two, 'Three': Three, 'Four': Four, 'Five': Five, 'Six': Six,
+ 'Seven': Seven, 'Eight': Eight, 'Nine': Nine, 'Ten': Ten,
+ 'Jack': Jack, 'Queen': Queen, 'King': King, 'Ace': Ace}
+
+SUITS = {'Spades': Spades, 'Diamonds': Diamonds, 'Hearts': Hearts,
+ 'Clubs': Clubs}
+
+
+class Card:
+ def __init__(self, rank, suit):
+ self.__rank = rank()
+ self.__suit = suit()
+
+ def __eq__(self, other):
+ return self.rank == other.rank and self.suit == other.suit
+
+ def __str__(self):
+ return str(self.rank) + " of " + str(self.suit)
+
+ def __repr__(self):
+ return "<" + str(self.rank) + " of " + str(self.suit) + ">"
+
+ @property
+ def rank(self):
+ return self.__rank
+
+ @property
+ def suit(self):
+ return self.__suit
+
+
+class CardCollection:
+ def __init__(self, collection=[]):
+ self.collection = [card for card in collection]
+
+ def __getitem__(self, index):
+ return self.collection[index]
+
+ def __len__(self):
+ return len(self.collection)
+
+ def __str__(self):
+ return str(self.collection)
+
+ def __repr__(self):
+ return str(self.collection)
+
+ def add(self, card):
+ self.collection.append(card)
+ return self
+
+ def draw(self, index):
+ return self.collection.pop(index)
+
+ def draw_from_top(self):
+ return self.collection.pop(len(self) - 1)
+
+ def draw_from_bottom(self):
+ return self.collection.pop(0)
+
+ def top_card(self):
+ return self.collection[-1]
+
+ def bottom_card(self):
+ return self.collection[0]
+
+ def index(self, card):
+ return self.collection.index(card)
+
+
+def StandardDeck():
+ all_ranks = "King Queen Jack Ten Nine Eight Seven Six Five Four Three\
+ Two Ace".split()
+ all_suits = "Diamonds Clubs Hearts Spades".split()
+ standart_cards = [Card(RANKS[rank], SUITS[suit]) for suit in all_suits
+ for rank in all_ranks]
+ return CardCollection(standart_cards)
+
+
+def BeloteDeck():
+ excluded_ranks = "Six Five Four Three Two".split()
+ belot_cards = [card for card in StandardDeck()
+ if str(card.rank) not in excluded_ranks]
+ return CardCollection(belot_cards)
+
+
+def SixtySixDeck():
+ excluded_ranks = "Eight Seven".split()
+ return [card for card in BeloteDeck()
+ if str(card.rank) not in excluded_ranks]

Петър обнови решението на 24.03.2014 01:33 (преди над 10 години)

class Rank:
def __init__(self, symbol):
self.symbol = symbol
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Suit:
def __init__(self, color):
self.color = color
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Two(Rank):
def __init__(self):
Rank.__init__(self, "2")
class Three(Rank):
def __init__(self):
Rank.__init__(self, "3")
class Four(Rank):
def __init__(self):
Rank.__init__(self, "4")
class Five(Rank):
def __init__(self):
Rank.__init__(self, "5")
class Six(Rank):
def __init__(self):
Rank.__init__(self, "6")
class Seven(Rank):
def __init__(self):
Rank.__init__(self, "7")
class Eight(Rank):
def __init__(self):
Rank.__init__(self, "8")
class Nine(Rank):
def __init__(self):
Rank.__init__(self, "9")
class Ten(Rank):
def __init__(self):
Rank.__init__(self, "10")
class Jack(Rank):
def __init__(self):
Rank.__init__(self, "J")
class Queen(Rank):
def __init__(self):
Rank.__init__(self, "Q")
class King(Rank):
def __init__(self):
Rank.__init__(self, "K")
class Ace(Rank):
def __init__(self):
Rank.__init__(self, "A")
class Spades(Suit):
def __init__(self):
Suit.__init__(self, "Spades")
class Diamonds(Suit):
def __init__(self):
Suit.__init__(self, "Diamonds")
class Hearts(Suit):
def __init__(self):
Suit.__init__(self, "Hearts")
class Clubs(Suit):
def __init__(self):
Suit.__init__(self, "Clubs")
RANKS = {'Two': Two, 'Three': Three, 'Four': Four, 'Five': Five, 'Six': Six,
'Seven': Seven, 'Eight': Eight, 'Nine': Nine, 'Ten': Ten,
'Jack': Jack, 'Queen': Queen, 'King': King, 'Ace': Ace}
SUITS = {'Spades': Spades, 'Diamonds': Diamonds, 'Hearts': Hearts,
'Clubs': Clubs}
class Card:
def __init__(self, rank, suit):
self.__rank = rank()
self.__suit = suit()
def __eq__(self, other):
return self.rank == other.rank and self.suit == other.suit
def __str__(self):
return str(self.rank) + " of " + str(self.suit)
def __repr__(self):
return "<" + str(self.rank) + " of " + str(self.suit) + ">"
@property
def rank(self):
return self.__rank
@property
def suit(self):
return self.__suit
class CardCollection:
def __init__(self, collection=[]):
self.collection = [card for card in collection]
def __getitem__(self, index):
return self.collection[index]
def __len__(self):
return len(self.collection)
def __str__(self):
return str(self.collection)
def __repr__(self):
return str(self.collection)
def add(self, card):
self.collection.append(card)
return self
def draw(self, index):
return self.collection.pop(index)
def draw_from_top(self):
return self.collection.pop(len(self) - 1)
def draw_from_bottom(self):
return self.collection.pop(0)
def top_card(self):
return self.collection[-1]
def bottom_card(self):
return self.collection[0]
def index(self, card):
return self.collection.index(card)
def StandardDeck():
- all_ranks = "King Queen Jack Ten Nine Eight Seven Six Five Four Three\
+ ALL_RANKS = "King Queen Jack Ten Nine Eight Seven Six Five Four Three\
Two Ace".split()
- all_suits = "Diamonds Clubs Hearts Spades".split()
- standart_cards = [Card(RANKS[rank], SUITS[suit]) for suit in all_suits
- for rank in all_ranks]
+ ALL_SUITS = "Diamonds Clubs Hearts Spades".split()
+ standart_cards = [Card(RANKS[rank], SUITS[suit]) for suit in ALL_SUITS
+ for rank in ALL_RANKS]
return CardCollection(standart_cards)
def BeloteDeck():
- excluded_ranks = "Six Five Four Three Two".split()
+ EXCLUDED_RANKS = "Six Five Four Three Two".split()
belot_cards = [card for card in StandardDeck()
- if str(card.rank) not in excluded_ranks]
+ if str(card.rank) not in EXCLUDED_RANKS]
return CardCollection(belot_cards)
def SixtySixDeck():
- excluded_ranks = "Eight Seven".split()
+ EXCLUDED_RANKS = "Eight Seven".split()
return [card for card in BeloteDeck()
- if str(card.rank) not in excluded_ranks]
+ if str(card.rank) not in EXCLUDED_RANKS]

Супер решение, но защо трябва да извикваш Rank.__init__? Не може ли просто да напишеш:

class Five:
    symbol = '5'

Браво, че си се сетил да използваш изхода от StandardDeck за BeloteDeck съответно за SixtySixDeck.

Петър обнови решението на 25.03.2014 00:10 (преди над 10 години)

class Rank:
- def __init__(self, symbol):
- self.symbol = symbol
-
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Suit:
- def __init__(self, color):
- self.color = color
-
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Two(Rank):
- def __init__(self):
- Rank.__init__(self, "2")
+ symbol = '2'
class Three(Rank):
- def __init__(self):
- Rank.__init__(self, "3")
+ symbol = '3'
class Four(Rank):
- def __init__(self):
- Rank.__init__(self, "4")
+ symbol = '4'
class Five(Rank):
- def __init__(self):
- Rank.__init__(self, "5")
+ symbol = '5'
class Six(Rank):
- def __init__(self):
- Rank.__init__(self, "6")
+ symbol = '6'
class Seven(Rank):
- def __init__(self):
- Rank.__init__(self, "7")
+ symbol = '7'
class Eight(Rank):
- def __init__(self):
- Rank.__init__(self, "8")
+ symbol = '8'
class Nine(Rank):
- def __init__(self):
- Rank.__init__(self, "9")
+ symbol = '9'
class Ten(Rank):
- def __init__(self):
- Rank.__init__(self, "10")
+ symbol = '10'
class Jack(Rank):
- def __init__(self):
- Rank.__init__(self, "J")
+ symbol = 'J'
class Queen(Rank):
- def __init__(self):
- Rank.__init__(self, "Q")
+ symbol = 'Q'
class King(Rank):
- def __init__(self):
- Rank.__init__(self, "K")
+ symbol = 'K'
class Ace(Rank):
- def __init__(self):
- Rank.__init__(self, "A")
+ symbol = 'A'
class Spades(Suit):
- def __init__(self):
- Suit.__init__(self, "Spades")
+ color = "Spades"
class Diamonds(Suit):
- def __init__(self):
- Suit.__init__(self, "Diamonds")
+ color = "Diamonds"
class Hearts(Suit):
- def __init__(self):
- Suit.__init__(self, "Hearts")
+ color = "Hearts"
class Clubs(Suit):
- def __init__(self):
- Suit.__init__(self, "Clubs")
+ color = "Clubs"
RANKS = {'Two': Two, 'Three': Three, 'Four': Four, 'Five': Five, 'Six': Six,
'Seven': Seven, 'Eight': Eight, 'Nine': Nine, 'Ten': Ten,
'Jack': Jack, 'Queen': Queen, 'King': King, 'Ace': Ace}
SUITS = {'Spades': Spades, 'Diamonds': Diamonds, 'Hearts': Hearts,
'Clubs': Clubs}
class Card:
def __init__(self, rank, suit):
self.__rank = rank()
self.__suit = suit()
def __eq__(self, other):
return self.rank == other.rank and self.suit == other.suit
def __str__(self):
return str(self.rank) + " of " + str(self.suit)
def __repr__(self):
return "<" + str(self.rank) + " of " + str(self.suit) + ">"
@property
def rank(self):
return self.__rank
@property
def suit(self):
return self.__suit
class CardCollection:
def __init__(self, collection=[]):
self.collection = [card for card in collection]
def __getitem__(self, index):
return self.collection[index]
def __len__(self):
return len(self.collection)
def __str__(self):
return str(self.collection)
def __repr__(self):
return str(self.collection)
def add(self, card):
self.collection.append(card)
return self
def draw(self, index):
return self.collection.pop(index)
def draw_from_top(self):
return self.collection.pop(len(self) - 1)
def draw_from_bottom(self):
return self.collection.pop(0)
def top_card(self):
return self.collection[-1]
def bottom_card(self):
return self.collection[0]
def index(self, card):
return self.collection.index(card)
def StandardDeck():
ALL_RANKS = "King Queen Jack Ten Nine Eight Seven Six Five Four Three\
Two Ace".split()
ALL_SUITS = "Diamonds Clubs Hearts Spades".split()
standart_cards = [Card(RANKS[rank], SUITS[suit]) for suit in ALL_SUITS
for rank in ALL_RANKS]
return CardCollection(standart_cards)
def BeloteDeck():
EXCLUDED_RANKS = "Six Five Four Three Two".split()
belot_cards = [card for card in StandardDeck()
if str(card.rank) not in EXCLUDED_RANKS]
return CardCollection(belot_cards)
def SixtySixDeck():
EXCLUDED_RANKS = "Eight Seven".split()
return [card for card in BeloteDeck()
if str(card.rank) not in EXCLUDED_RANKS]

Направих класовете така. Надявам се, че така няма да се счупи функционално(примерните тестове и тези от форума минаха).
Но има нещо което малко ме тревожи. В условието за класовете Rank и Suit пише съответно:
class Rank # вид на картата
symbol # символът на картата (A, 2, Q, K)

и
class Suit # боя на картата
color # цветът на боята ('red', 'black')

Това значи ли, че тези класове трябва да съдържат променливи - symbol за Rank и color за Suit ? (с така направени класовете Two, Three...King, Ace просто няма нужда от тях, а също така и от конструктур за Rank и Suit и затова ги махнах, това проблем ли е ? )

Петър обнови решението на 25.03.2014 09:42 (преди над 10 години)

class Rank:
+ symbol = ''
+
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Suit:
+ color = ''
+
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Two(Rank):
symbol = '2'
class Three(Rank):
symbol = '3'
class Four(Rank):
symbol = '4'
class Five(Rank):
symbol = '5'
class Six(Rank):
symbol = '6'
class Seven(Rank):
symbol = '7'
class Eight(Rank):
symbol = '8'
class Nine(Rank):
symbol = '9'
class Ten(Rank):
symbol = '10'
class Jack(Rank):
symbol = 'J'
class Queen(Rank):
symbol = 'Q'
class King(Rank):
symbol = 'K'
class Ace(Rank):
symbol = 'A'
class Spades(Suit):
color = "Spades"
class Diamonds(Suit):
color = "Diamonds"
class Hearts(Suit):
color = "Hearts"
class Clubs(Suit):
color = "Clubs"
RANKS = {'Two': Two, 'Three': Three, 'Four': Four, 'Five': Five, 'Six': Six,
'Seven': Seven, 'Eight': Eight, 'Nine': Nine, 'Ten': Ten,
'Jack': Jack, 'Queen': Queen, 'King': King, 'Ace': Ace}
SUITS = {'Spades': Spades, 'Diamonds': Diamonds, 'Hearts': Hearts,
'Clubs': Clubs}
class Card:
def __init__(self, rank, suit):
self.__rank = rank()
self.__suit = suit()
def __eq__(self, other):
return self.rank == other.rank and self.suit == other.suit
def __str__(self):
return str(self.rank) + " of " + str(self.suit)
def __repr__(self):
return "<" + str(self.rank) + " of " + str(self.suit) + ">"
@property
def rank(self):
return self.__rank
@property
def suit(self):
return self.__suit
class CardCollection:
def __init__(self, collection=[]):
self.collection = [card for card in collection]
def __getitem__(self, index):
return self.collection[index]
def __len__(self):
return len(self.collection)
def __str__(self):
return str(self.collection)
def __repr__(self):
return str(self.collection)
def add(self, card):
self.collection.append(card)
return self
def draw(self, index):
return self.collection.pop(index)
def draw_from_top(self):
return self.collection.pop(len(self) - 1)
def draw_from_bottom(self):
return self.collection.pop(0)
def top_card(self):
return self.collection[-1]
def bottom_card(self):
return self.collection[0]
def index(self, card):
return self.collection.index(card)
def StandardDeck():
ALL_RANKS = "King Queen Jack Ten Nine Eight Seven Six Five Four Three\
Two Ace".split()
ALL_SUITS = "Diamonds Clubs Hearts Spades".split()
standart_cards = [Card(RANKS[rank], SUITS[suit]) for suit in ALL_SUITS
for rank in ALL_RANKS]
return CardCollection(standart_cards)
def BeloteDeck():
EXCLUDED_RANKS = "Six Five Four Three Two".split()
belot_cards = [card for card in StandardDeck()
if str(card.rank) not in EXCLUDED_RANKS]
return CardCollection(belot_cards)
def SixtySixDeck():
EXCLUDED_RANKS = "Eight Seven".split()
return [card for card in BeloteDeck()
if str(card.rank) not in EXCLUDED_RANKS]

Петър обнови решението на 26.03.2014 02:43 (преди над 10 години)

class Rank:
symbol = ''
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Suit:
color = ''
def __eq__(self, other):
return self.__class__.__name__ == other.__class__.__name__
def __str__(self):
return self.__class__.__name__
class Two(Rank):
symbol = '2'
class Three(Rank):
symbol = '3'
class Four(Rank):
symbol = '4'
class Five(Rank):
symbol = '5'
class Six(Rank):
symbol = '6'
class Seven(Rank):
symbol = '7'
class Eight(Rank):
symbol = '8'
class Nine(Rank):
symbol = '9'
class Ten(Rank):
symbol = '10'
class Jack(Rank):
symbol = 'J'
class Queen(Rank):
symbol = 'Q'
class King(Rank):
symbol = 'K'
class Ace(Rank):
symbol = 'A'
class Spades(Suit):
- color = "Spades"
+ color = "black"
class Diamonds(Suit):
- color = "Diamonds"
+ color = "red"
class Hearts(Suit):
- color = "Hearts"
+ color = "red"
class Clubs(Suit):
- color = "Clubs"
+ color = "black"
RANKS = {'Two': Two, 'Three': Three, 'Four': Four, 'Five': Five, 'Six': Six,
'Seven': Seven, 'Eight': Eight, 'Nine': Nine, 'Ten': Ten,
'Jack': Jack, 'Queen': Queen, 'King': King, 'Ace': Ace}
SUITS = {'Spades': Spades, 'Diamonds': Diamonds, 'Hearts': Hearts,
'Clubs': Clubs}
class Card:
def __init__(self, rank, suit):
self.__rank = rank()
self.__suit = suit()
def __eq__(self, other):
return self.rank == other.rank and self.suit == other.suit
def __str__(self):
return str(self.rank) + " of " + str(self.suit)
def __repr__(self):
return "<" + str(self.rank) + " of " + str(self.suit) + ">"
@property
def rank(self):
return self.__rank
@property
def suit(self):
return self.__suit
class CardCollection:
def __init__(self, collection=[]):
self.collection = [card for card in collection]
def __getitem__(self, index):
return self.collection[index]
def __len__(self):
return len(self.collection)
def __str__(self):
return str(self.collection)
def __repr__(self):
return str(self.collection)
def add(self, card):
self.collection.append(card)
return self
def draw(self, index):
return self.collection.pop(index)
def draw_from_top(self):
return self.collection.pop(len(self) - 1)
def draw_from_bottom(self):
return self.collection.pop(0)
def top_card(self):
return self.collection[-1]
def bottom_card(self):
return self.collection[0]
def index(self, card):
return self.collection.index(card)
def StandardDeck():
ALL_RANKS = "King Queen Jack Ten Nine Eight Seven Six Five Four Three\
Two Ace".split()
ALL_SUITS = "Diamonds Clubs Hearts Spades".split()
standart_cards = [Card(RANKS[rank], SUITS[suit]) for suit in ALL_SUITS
for rank in ALL_RANKS]
return CardCollection(standart_cards)
def BeloteDeck():
EXCLUDED_RANKS = "Six Five Four Three Two".split()
belot_cards = [card for card in StandardDeck()
if str(card.rank) not in EXCLUDED_RANKS]
return CardCollection(belot_cards)
def SixtySixDeck():
EXCLUDED_RANKS = "Eight Seven".split()
return [card for card in BeloteDeck()
if str(card.rank) not in EXCLUDED_RANKS]