update from atlas

This commit is contained in:
Luciano Ramalho
2015-03-31 16:53:46 -03:00
parent 290079ec9a
commit 104b2c9d2d
24 changed files with 674 additions and 205 deletions

View File

@@ -0,0 +1,17 @@
import collections
Card = collections.namedtuple('Card', ['rank', 'suit'])
class FrenchDeck:
ranks = [str(n) for n in range(2, 11)] + list('JQKA')
suits = 'spades diamonds clubs hearts'.split()
def __init__(self):
self._cards = [Card(rank, suit) for suit in self.suits
for rank in self.ranks]
def __len__(self):
return len(self._cards)
def __getitem__(self, position):
return self._cards[position]