Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion python2/koans/about_scoring_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,23 @@
# Your goal is to write the score method.

def score(dice):
final_score = 0
repeated_nums = [0, 0, 0, 0, 0, 0]
for number in dice:
repeated_nums[number-1]=repeated_nums[number-1] + 1
for i in xrange(len(repeated_nums)):
aux1 = repeated_nums[i] // 3
aux2 = repeated_nums[i] % 3
# This change the values of i from 0-5 to 1-6.
i += 1
if i == 1:
final_score = final_score + (aux1 * 1000) + (aux2 * 100)
elif i == 5:
final_score = final_score + (aux1 * 100 * 5) + (aux2 * 50)
else:
final_score = final_score + (aux1 * 100 * i)
# You need to write this method
pass
return final_score


class AboutScoringProject(Koan):
Expand Down