Your use case for gathering roll statistics probably needs a more general solution:
hands = {
(1,1,1,1,1): 'nothing',
(1,1,1,2): 'one pair',
(1,2,2): 'two pair',
(1,1,3): 'three of a kind',
(2,3): 'full house',
(1,4): 'four of a kind',
(5): 'flush (five of a kind)'
}
def eval_hand(hand):
counts = tuple(sorted(hand.count(card) for card in set(hand)))
return hands.get(counts, 'misdeal')
Raymond Hettinger
--
http://mail.python.org/mailman/listinfo/python-list
