## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.  PLUS

# Bummer Try again!

Great! Let's make one more scoring method! Create a score_yatzy method. If there are five dice with the same value, return 50. Otherwise, return 0.

scoresheets.py
```from hands import YatzyHand as yh

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):
if len(yh._by_value(1)) == 5:
return 50
if len(yh._by_value(2)) == 5:
return 50
if len(yh._by_value(3)) == 5:
return 50
if len(yh._by_value(4)) == 5:
return 50
if len(yh._by_value(5)) == 5:
return 50
if len(yh._by_value(6)) == 5:
return 50
else:
return 0
```

Here's another way to approach it:

```    def score_yatzy(self, hand):
if len(set(hand)) == 1:
return 50
else:
return 0
```

If all five dice have the same value, then the length of the set should be one as there is only a single unique value.

Very clever, @renhe. It looks like the solution was mainly a matter of logic. Thanks for this; I was definitely overthinking things. :) Why isn't my code here working?

```def score_yatzy(self, hand):
allSame = True
holder = []
for dice_roll in hand:
holder.append(dice_roll.value)
for value in holder:
if dice_roll != value:
allSame = False
if allSame:
return 50
return 0```
``` ```def score_yatzy(self,hand):
if self._score_set(hand, 5):
return 50
else:
return 0
```

Meaning: If the function self._score_set(hand,5) returns True or any sort of Truthy data it means there are 5 of the same in the hand - therefore the if conditions returns 50. Otherwise it returns 0. I just did a fairly lazy compare between each item in the hand list.

if hand == hand  and hand == hand and hand == hand and hand == hand: return 50 else: return 0

That seemed to do the trick. Not very elegant and I'm sure you could enumerate through the list and then return zero the first time you get an unequal item (not equal to the last item you checked), otherwise return 50. It would be much more flexible for longer lists but I'll leave that up to you.