finallywe come to the score method this is the function that will determine the worth of the current dice we need to examine the values and determine whether we have any of the patterns that lead to payoffnamelyfive of kindfour of kindfull housethree of kindtwo pairsor straight our function will need some way to indicate what the payoff is let' return string labeling what the hand is and an int that gives the payoff amount we can think of this function as multi-way decision we simply need to check for each possible hand if we do so in sensible orderwe can guarantee giving the correct payout for examplea full house also contains three of kind we need to check for the full house before checking for three of kindsince the full house is more valuable one simple way of checking the hand is to generate list of the counts of each value that iscounts[iwill be the number of times that the value occurs in dice if the dice are[ , , , , then the count list would be [ , , , , , , notice that counts[ will always be zerosince dice values are in the range - checking for various hands can then be done by looking for various values in counts for exampleif counts contains and the hand contains triple and pairhenceit is full house here' the codedef score(self)create the counts list counts [ for value in self dicecounts[valuecounts[value score the hand if in countsreturn "five of kind" elif in countsreturn "four of kind" elif ( in countsand ( in counts)return "full house" elif in countsreturn "three of kind" elif not ( in countsand (counts[ ]== or counts[ = )return "straight" elif counts count( = return "two pairs" elsereturn "garbage" the only tricky part is the testing for straights since we have already checked for and of kindchecking that there are no pairs--not in counts--guarantees that the dice show five distinct values if there is no then the values must be - likewiseno means the values must be -