inport unittest def Highestkapeat (dice,nintapeats): unique- set(dice) repeats- [x for x in unique if Count (dice,x) sinhepeats] return na(repeats) if repeats else e def OFAKind(dice, n): return Highestkepeat (dice,n) n def Count (dice, nun) return len(fy for y in dice if y un) def SunoFSingle(bice, selected): return sum([x for x in dice if x - selected]) def Chance(dice): return sum(dice) def Pair(dice): return OFAKind(dice, 2) def ThreeofAKind(dice): return OfAKLnd(dice, 3) def FourofAind(dice): return OFAKind(dice, 4) def Snallstraight (dice): return 15 if tuple(sorted(dice)) - (1,2,3,4,5) else e def Largeststraight(dice): return 20 if tuple(sorted(dice)) - (2,3,4,5,5) else e 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 Sines(dice): return SunoFSingle(dice,5) def vahtzee(dice): return se if 1on(dice) s and len(set (dice)) -1 else e class vahtaee(unittest.TestCase): testCases ( ((1,2,3,4,5). 1 , Ones), ((1,2,3,4,5). 2 . Tos), ((3,2,3,4,3) .9. Threes), ((3,2,3,4,4). e. Sines), ((1,2,3,4,5) .e. Pair). ((1,5,3,4,5). 1e, Pair). ((2,2,6,6,4) . 12, Pair). ((2,3,3,1,3), 5, Pair) ((5,5,5,5,5) . se, Yahtaee). ((1,5,5,5,5) .e. vahtaee). ((1,2,3,4,5) , 15, Chance),) def testkunkli(sel): for(dice, expected, strategy) in self.testcases:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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

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)
Transcribed Image 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)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education