We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fb21cf1 commit 67ea808Copy full SHA for 67ea808
1 file changed
python2/koans/about_scoring_project.py
@@ -34,8 +34,23 @@
34
# Your goal is to write the score method.
35
36
def score(dice):
37
- # You need to write this method
38
- pass
+ counts = { number: 0 for number in range(1,7) }
+ for number in dice:
39
+ counts[number] = counts[number] + 1
40
+
41
+ score = 0
42
+ if counts[1] >= 3:
43
+ score += 1000
44
+ counts[1] -= 3
45
+ for number in range(2,7):
46
+ if counts[number] >= 3:
47
+ score += number * 100
48
+ counts[number] -= 3
49
+ if counts[1] > 0:
50
+ score += 100 * counts[1]
51
+ if counts[5] > 0:
52
+ score += 50 * counts[5]
53
+ return score
54
55
56
class AboutScoringProject(Koan):
0 commit comments