Александър обнови решението на 26.03.2014 00:31 (преди над 11 години)
+import collections
+
+RANK_TO_SYMBOL = (('Ace', 'A'), ('Two', '2'), ('Three', '3'), ('Four', '4'),
+                  ('Five', '5'), ('Six', '6'), ('Seven', '7'), ('Eight', '8'),
+                  ('Nine', '9'), ('Ten', '10') , ('Jack', 'J'), ('Queen', 'Q'),
+                  ('King', 'K'))
+
+
+class Rank:
+    def __init__(self, symbol):
+        self.symbol = symbol
+    def __eq__(self, other):
+        return self.symbol == other.symbol
+    def __str__(self):
+        for rank in RANK_TO_SYMBOL:
+            if self.symbol == rank[1]:
+                return rank[0]
+
+
+class Suit:
+    def __init__(self, color):
+        self.color = color
+    def __eq__(self, other):
+        return self.__class__ == other.__class__
+    def __str__(self):
+        for suit in SUIT_TO_CLASS:
+            if type(self) == suit[1]:
+                return suit[0]
+
+
+class Ace(Rank):
+    def __init__(self):
+        self.symbol = 'A'
+
+
+class Two(Rank):
+    def __init__(self):
+        self.symbol = '2'
+
+
+class Three(Rank):
+    def __init__(self):
+        self.symbol = '3'
+
+
+class Four(Rank):
+    def __init__(self):
+        self.symbol = '4'
+
+
+class Five(Rank):
+    def __init__(self):
+        self.symbol = '5'
+
+
+class Six(Rank):
+    def __init__(self):
+        self.symbol = '6'
+
+
+class Seven(Rank):
+    def __init__(self):
+        self.symbol = '7'
+
+
+class Eight(Rank):
+    def __init__(self):
+        self.symbol = '8'
+
+
+class Nine(Rank):
+    def __init__(self):
+        self.symbol = '9'
+
+
+class Ten(Rank):
+    def __init__(self):
+        self.symbol = '10'
+
+
+class Jack(Rank):
+    def __init__(self):
+        self.symbol = 'J'
+
+
+class Queen(Rank):
+    def __init__(self):
+        self.symbol = 'Q'
+
+
+class King(Rank):
+    def __init__(self):
+        self.symbol = 'K'
+
+
+class Diamonds(Suit):
+    def __init__(self):
+        self.color = 'red'
+
+
+class Hearts(Suit):
+    def __init__(self):
+        self.color = 'red'
+
+
+class Spades(Suit):
+    def __init__(self):
+        self.color = 'black'
+
+
+class Clubs(Suit):
+    def __init__(self):
+        self.color = 'black'
+
+
+RANKS = collections.OrderedDict()
+
+RANKS['King'] = type(King())
+RANKS['Queen'] = type(Queen())
+RANKS['Jack'] = type(Jack())
+RANKS['Ten'] = type(Ten())
+RANKS['Nine'] = type(Nine())
+RANKS['Eight'] = type(Eight())
+RANKS['Seven'] = type(Seven())
+RANKS['Six'] = type(Six())
+RANKS['Five'] = type(Five())
+RANKS['Four'] = type(Four())
+RANKS['Three'] = type(Three())
+RANKS['Two'] = type(Two())
+RANKS['Ace'] = type(Ace())
+
+SUITS = collections.OrderedDict()
+
+SUITS['Diamonds'] = type(Diamonds())
+SUITS['Clubs'] = type(Clubs())
+SUITS['Hearts'] = type(Hearts())
+SUITS['Spades'] = type(Spades())
+
+
+SUIT_TO_CLASS = (('Diamonds', type(Diamonds())), ('Hearts', type(Hearts())),
+                 ('Spades', type(Spades())), ('Clubs', type(Clubs())))
+
+
+class Card:
+    @property#.setter
+    def rank(self, value):
+        self._rank = value
+    @property#.setter
+    def suit(self, value):
+        self._suit = value
+    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 '{0} of {1}'.format(str(self._rank), str(self._suit))
+
+
+class CardCollection:
+    def __init__(self, collection):
+        self._collection = collection
+    def draw(self, index):
+        for i in range(0, len(self._collection)):
+            if index == i:
+                result = self._collection[i]
+                self._collection.remove(self._collection[i])
+                return str(result)
+    def draw_from_top(self):
+        draw(self, len(self._collection) - 1)
+    def draw_from_bottom(self):
+        draw(self, 0)
+    def top_card(self):
+        return str(self._collection[len(self._collection)-1])
+    def bottom_card(self):
+        return str(self._collection[0])
+    def add(self, card):
+        self._collection.append(card)
+    def index(self, card):
+        index = 0
+        found_card = False
+        for collection_card in self._collection:
+            if collection_card == card:
+                return index
+            else:
+                index += 1
+        if found_card == False:
+            raise ValueError('<Card {0}> is not in list'.format(str(card)))
+    def __getitem__(self, index):
+        return str(self._collection[index])
+
+def StandardDeck():
+    standard_deck = []
+    for suit in SUITS:
+        for rank in RANKS:
+            standard_deck.append('<Card {0} of {1}>'.format(rank, suit))
+    return standard_deck
+
+def BeloteDeck():
+    belote_deck = []
+    for suit in SUITS:
+        for rank in RANKS:
+            if rank == 'Six':
+                break
+            else:
+                belote_deck.append('<Card {0} of {1}>'.format(rank, suit))
+    return belote_deck
+
+def SixtySixDeck():
+    sixty_six_deck = []
+    for suit in SUITS:
+        for rank in RANKS:
+            if rank == 'Eight':
+                break
+            else:
+                sixty_six_deck.append('<Card {0} of {1}>'.format(rank, suit))
+    return sixty_six_deck
+    
