updated contents from Atlas repo

This commit is contained in:
Luciano Ramalho
2014-10-14 14:26:55 -03:00
parent 40688c038d
commit 981d5bc473
157 changed files with 71134 additions and 1 deletions

19
interfaces/bingo.py Normal file
View File

@@ -0,0 +1,19 @@
import random
from tombola import Tombola
class BingoCage(Tombola): # <1>
def __init__(self, items):
self._balls = list(items) # <2>
def load(self, items):
self._balls.extend(items)
def pop(self):
try:
position = random.randrange(len(self._balls)) # <4>
except ValueError:
raise LookupError('pop from empty BingoCage')
return self._balls.pop(position)