I did everything that was written here and my code looks like what was written but I am getting an error. - ninhepeats]return max (repeats) 1f repeats else edef OFAK ind(dice, n):return...


I did everything that was written here and my code looks like what was written but I am getting an error.


Smport unittest<br>def HighestRepeat (dice,sintepeats):<br>unique- set(dice)<br>repeats - [x for x in unique if Count (dice,x) >- ninhepeats]<br>return max (repeats) 1f repeats else e<br>def OFAK ind(dice, n):<br>return Highestkepeat (dice,n)n<br>def Count (dice, num):<br>return len([y for y in dice if y -- nun])<br>def SunoFSingle (Dice, selected):<br>return sun([x for x in dice if x -- selected])<br>def Chance(dice):<br>return sun(dice)<br>def Pair(dice):<br>return OFAK Lnd(dice, 2)<br>def ThreedFAKind(dice):<br>return OFAKind(dice, 3)<br>def FourOFAK ind (dice):<br>return OFAKLnd(dice, 4)<br>def Smallstraight (dice):<br>return 15 if tuple(sorted(dice)) -- (1,2,3,4,5) else a<br>def LargestStraight(dice):<br>return 28 if tuple(sarted(dice)) - (2,3,4,5,6) else a<br>def Ones (dice):<br>return SunofSingle(dice,1)<br>def Twos(dice):<br>return SunoFSingle(dice, 2)<br>def Threes (dice):<br>return Sunofsingle(dice,3)<br>def Fours (dice):<br>return SunoFSingle(dice,4)<br>def Fives (dice):<br>return SunoFSingle(dice,5)<br>def Sies (dice):<br>return SunofSingle(dice,6)<br>def Yahtzee(dice):<br>return sa if len(dice) -- 5 and len( set (dice)) -- 1 else e<br>class Yahtzee(unittest.TestCase):<br>testCases (<br>((1,2,3,4,5) , 1, Ones),<br>((1,2,3,4,5) , 2, Twos),<br>((3,2,3,4,3) ,9, Threes),<br>((3,2,3,4,4) ., Sixes).<br>((1,2,3,4,5) , a, Pair),<br>((1,5,3,4,5) , 18, Pair),<br>((2,2,6,6,4) , 12, Pair),<br>((2,3,3,1,3) . 6, Pair).<br>((5,5,5,5,5) . 5a, Yahtzee).<br>((1,5,5,5,5). a<br>((1,2,3,4,5), 15, Chance),)<br>Yahtzee),<br>def testRunall(self):<br>for (dice, expected, strategy) in self.testCases:<br>score - strategy(dice)<br>self.assertéquals(expected, score,

Extracted text: Smport unittest def HighestRepeat (dice,sintepeats): unique- set(dice) repeats - [x for x in unique if Count (dice,x) >- ninhepeats] return max (repeats) 1f repeats else e def OFAK ind(dice, n): return Highestkepeat (dice,n)n def Count (dice, num): return len([y for y in dice if y -- nun]) def SunoFSingle (Dice, selected): return sun([x for x in dice if x -- selected]) def Chance(dice): return sun(dice) def Pair(dice): return OFAK Lnd(dice, 2) def ThreedFAKind(dice): return OFAKind(dice, 3) def FourOFAK ind (dice): return OFAKLnd(dice, 4) def Smallstraight (dice): return 15 if tuple(sorted(dice)) -- (1,2,3,4,5) else a def LargestStraight(dice): return 28 if tuple(sarted(dice)) - (2,3,4,5,6) else a def Ones (dice): return SunofSingle(dice,1) def Twos(dice): return SunoFSingle(dice, 2) def Threes (dice): return Sunofsingle(dice,3) def Fours (dice): return SunoFSingle(dice,4) def Fives (dice): return SunoFSingle(dice,5) def Sies (dice): return SunofSingle(dice,6) def Yahtzee(dice): return sa if len(dice) -- 5 and len( set (dice)) -- 1 else e class Yahtzee(unittest.TestCase): testCases ( ((1,2,3,4,5) , 1, Ones), ((1,2,3,4,5) , 2, Twos), ((3,2,3,4,3) ,9, Threes), ((3,2,3,4,4) ., Sixes). ((1,2,3,4,5) , a, Pair), ((1,5,3,4,5) , 18, Pair), ((2,2,6,6,4) , 12, Pair), ((2,3,3,1,3) . 6, Pair). ((5,5,5,5,5) . 5a, Yahtzee). ((1,5,5,5,5). a ((1,2,3,4,5), 15, Chance),) Yahtzee), def testRunall(self): for (dice, expected, strategy) in self.testCases: score - strategy(dice) self.assertéquals(expected, score, "(8) expected (1), testing with the (2) on (3)".format(score,expected, strategy._name print ('ran (e) test cases '. format(len(self.testCase))) name unittest.main() if sain': ERROR: C: \users\evand\Appoata\Roaming \jupyter\runtime\kernel-adasfe4a-65c4-40F3-9dab-3216F2Fea035 (unittest.loader. _FailedTest) has no attribute "C:\users\evandApplata\Roaming\ jupyter\runtimekernel-edasfe4e-65c4-40F3-9d Attributeerror: module main ab-3216f2aas Ran 1 test in 0.082s FAILED (errors-1) An exception has occurred, use Xtb to see the full traceback. Systenexit: True C: \users\evand'\anaconda3\lib\site-packages\IPythan\core\interactiveshel1.py:3452: Userwarning: To exit: use 'exit', 'quit', or Ctrl-D. warm("To exit: use 'exit', 'quit', ar Ctrl-D.", stacklevel-1)
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here