Skip to content

Commit 44a828f

Browse files
author
aresyang
committed
finish about_score_project
1 parent a42aea5 commit 44a828f

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

python2/koans/about_scoring_project.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,20 @@
3535

3636
def score(dice):
3737
# You need to write this method
38-
sum = 0
39-
one_cnt = 0
40-
five_cnt;
41-
for x in dice:
42-
if x == 1
43-
pass
44-
38+
score = 0
39+
for i in range(1, 10):
40+
count = dice.count(i)
41+
if count >=3:
42+
if i == 1:
43+
score += 1000;
44+
else:
45+
score += i*100
46+
count -= 3
47+
if i == 1:
48+
score +=100 * count
49+
if i == 5:
50+
score += 50 * count
51+
return score
4552

4653
class AboutScoringProject(Koan):
4754
def test_score_of_an_empty_list_is_zero(self):

0 commit comments

Comments
 (0)