[Tony Meyer] >> def isfullHouse(roll): >> return len(set(roll)) != 2
[Robert Kern]
> [1, 1, 1, 1, 2] is not a full house.
Opps. I did say it was untested (that should have been == not !=, too).
What about:
def isfullHouse(roll):
return len(set(roll)) == 2 and roll.count(min(roll)) != 1 and
roll.count(max(roll)) != 1
Although your solution looks a lot nicer than this (though it may use more
memory, and might be slower).
=Tony.Meyer
--
http://mail.python.org/mailman/listinfo/python-list
