
Yuyang Peng
5,665 Pointshand.ones Shouldn't 1s,2s,3s,4s,5s be YatzyHand s property?
So in the YatzyScoreSheet class, Kenneth used hand.ones. Looking back and I found out that those values belong to YatsyHand instead of hand and Yatsyhand is a subclass of hand,so hand shouldn't have access to properties? Could someone explain this to me please?
class YatzyScoreSheet: def score_ones(self, hand): return sum(hand.ones)
2 Answers

Dave StSomeWhere
19,810 PointsThe "hand" defined in YatzyScoresheet is not referring to the class Hand - it is just the variable name used for the arguments (so it does seem confusing).
You'll notice that when testing the code, Kenneth imports and instantiates the YatzyHand class:
from hands import YatzyHand
from dice import D6
from scoresheets import YatzyScoresheet
hand = YatzyHand()
Does that make sense?

Anthony Grodowski
4,902 PointsI feel angry at Kenneth now because he didn't say what excatly hand
is doing there and I wasted like an hour on figuring that out because it completely didn't make sense until watching the rest of the video... SMH
Yuyang Peng
5,665 PointsYuyang Peng
5,665 Pointsahhh yeah, god I feel embarrassed, hahahhaha thank you Dave !