Решение на Тесте карти от Герасим Станчев

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

Към профила на Герасим Станчев

Резултати

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

Код

import collections
class Rank:
def __init__(self):
symbol = ('A', 'K', 'Q', 'J', '10', '9', '8',
'7', '6', '5', '4', '3', '2')
return symbol
def __eq__(self, rank):
return self.rank == rank
class Suit:
def __init__(self):
color = ('red', 'black')
class Two(Rank):
def __init__(self):
self.rank = '2'
class Three(Rank):
def __init__(self):
self.rank = '3'
class Four(Rank):
def __init__(self):
self.rank = '4'
class Five(Rank):
def __init__(self):
self.rank = '5'
class Six(Rank):
def __init__(self):
self.rank = '6'
class Seven(Rank):
def __init__(self):
self.rank = '7'
class Eight(Rank):
def __init__(self):
self.rank = '8'
class Nine(Rank):
def __init__(self):
self.rank = '9'
class Ten(Rank):
def __init__(self):
self.rank = '10'
class Jack(Rank):
def __init__(self):
self.rank = 'J'
class Queen(Rank):
def __init__(self):
self.rank = 'Q'
class King(Rank):
def __init__(self):
self.rank = 'K'
class Ace(Rank):
def __init__(self):
self.rank = 'A'
class RANKS:
RANKS = {}
for derived in Rank.__subclasses__():
RANKS[str(derived.__name__)] = derived
def __init__(self, rank):
self.rank = rank
class Spades(Suit):
def __init__(self):
self.suit = 'black'
self.name = 'Spades'
class Hearts(Suit):
def __init__(self):
self.suit = 'red'
self.name = 'Hearts'
class Diamonds(Suit):
def __init__(self):
self.suit = 'red'
self.name = 'Diamonds'
class Clubs(Suit):
def __init__(self):
self.suit = 'black'
self.name = 'Clubs'
class SUITS:
classes_in_suit = {}
for suit in Suit.__subclasses__():
classes_in_suit[suit.__name__] = suit
class Card:
rank
def __init__(self, rank):
self.rank = Rank(rank)

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

File "lib/language/python/runner.py", line 99, in main
    test = imp.load_source('test', test_module)
  File "/opt/python3.3/lib/python3.3/imp.py", line 109, in load_source
    return _LoadSourceCompatibility(name, pathname, file).load_module(name)
  File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1023, in load_module
  File "<frozen importlib._bootstrap>", line 1004, in load_module
  File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 869, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "/tmp/d20140407-19315-9thpkb/test.py", line 4, in <module>
    import solution
  File "/tmp/d20140407-19315-9thpkb/solution.py", line 98, in <module>
    class Card:
  File "/tmp/d20140407-19315-9thpkb/solution.py", line 99, in Card
    rank

История (1 версия и 0 коментара)

Герасим обнови решението на 26.03.2014 01:12 (преди над 10 години)

+import collections
+class Rank:
+ def __init__(self):
+ symbol = ('A', 'K', 'Q', 'J', '10', '9', '8',
+ '7', '6', '5', '4', '3', '2')
+ return symbol
+ def __eq__(self, rank):
+ return self.rank == rank
+
+class Suit:
+ def __init__(self):
+ color = ('red', 'black')
+
+class Two(Rank):
+ def __init__(self):
+ self.rank = '2'
+
+class Three(Rank):
+ def __init__(self):
+ self.rank = '3'
+
+class Four(Rank):
+ def __init__(self):
+ self.rank = '4'
+
+class Five(Rank):
+ def __init__(self):
+ self.rank = '5'
+
+class Six(Rank):
+ def __init__(self):
+ self.rank = '6'
+
+class Seven(Rank):
+ def __init__(self):
+ self.rank = '7'
+
+class Eight(Rank):
+ def __init__(self):
+ self.rank = '8'
+
+class Nine(Rank):
+ def __init__(self):
+ self.rank = '9'
+
+class Ten(Rank):
+ def __init__(self):
+ self.rank = '10'
+
+class Jack(Rank):
+ def __init__(self):
+ self.rank = 'J'
+
+class Queen(Rank):
+ def __init__(self):
+ self.rank = 'Q'
+
+class King(Rank):
+ def __init__(self):
+ self.rank = 'K'
+
+class Ace(Rank):
+ def __init__(self):
+ self.rank = 'A'
+
+class RANKS:
+ RANKS = {}
+ for derived in Rank.__subclasses__():
+ RANKS[str(derived.__name__)] = derived
+ def __init__(self, rank):
+ self.rank = rank
+
+class Spades(Suit):
+ def __init__(self):
+ self.suit = 'black'
+ self.name = 'Spades'
+
+class Hearts(Suit):
+ def __init__(self):
+ self.suit = 'red'
+ self.name = 'Hearts'
+
+class Diamonds(Suit):
+ def __init__(self):
+ self.suit = 'red'
+ self.name = 'Diamonds'
+
+class Clubs(Suit):
+ def __init__(self):
+ self.suit = 'black'
+ self.name = 'Clubs'
+
+class SUITS:
+ classes_in_suit = {}
+ for suit in Suit.__subclasses__():
+ classes_in_suit[suit.__name__] = suit
+
+class Card:
+ rank
+ def __init__(self, rank):
+ self.rank = Rank(rank)