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:
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
Related questions
Question
I did everything that was written here and my code looks like what was written but I am getting an error.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Knowledge Booster
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
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education