Welcome to the Treehouse Community
Looking to learn something new?
There has GOT to be a better way to identify what is wrong with the challenge instead of just "Bummer! Try again!"
Beating my head on the wall again!
Assuming a hand size of 5 for Yatzy, checking to see that the _score_set returns truthy for five values, should be enough. I tried checking that the hand size was 5.
I tried testing with 7 different hands. hand[:] = [one, three, three, four, four] hand2[:] = [one, one, one, one] hand3[:] = [one, one, one, two] hand4[:] = [one, one, one, one, one] hand5[:] = [one, one, one, one, two] hand6[:] = [one, one, one, one, one, one] hand7[:] = [one, one, one, one, one, two]
When hand size wasn't limited to 5, both hand4 and hand7 returned 50. When hand size was limited to 5, only hand4 returned 50.
class YatzyScoresheet: def score_ones(self, hand): return sum(hand.ones) def _score_set(self, hand, set_size): scores =  for worth, count in hand._sets.items(): if count == set_size: scores.append(worth*set_size) return max(scores) def score_one_pair(self, hand): return self._score_set(hand, 2) def score_chance(self, hand): return sum(hand) def score_yatzy(self, hand): #if len(hand) == 5 and self._score_set(hand, 5): if self._score_set(hand, 5): return 50 return 0
Steven Parker215,939 Points
This code passes the challenge.
I just pasted it in and it passed! Try again?
But I agree those "Bummer" messages aren't always very helpful.
Nice! Two hours down the drain because of ... ?