Python Object-Oriented Python Dice Roller Chance Scoring

Theo kootlogele
Theo kootlogele
5,619 Points


got the wrong score
class YatzyScoresheet:
    def score_ones(self, hand):
        return sum(hand.ones)

    def _score_set(self, hand, set_size):
        scores = [0]
        for worth, count in hand._sets.items():
            if count == set_size:
        return max(scores)

    def score_one_pair(self, hand):
        return self._score_set(hand, 2)
    def score_chance(self, hand):
        if hand[0] == hand[1] and hand[1] == hand[2] and hand[2] == hand[3] and hand[3] == hand[4]:
            return 50
            return 0

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 57,149 Points

It looks like you’ve mixed your code for two tasks. The score_chance method should be separate from the score_yatzy method.

Post back if you need more help. Good luck!!!