diff --git a/python2/koans/about_scoring_project.py b/python2/koans/about_scoring_project.py index da51563b4..3bf5c7583 100644 --- a/python2/koans/about_scoring_project.py +++ b/python2/koans/about_scoring_project.py @@ -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):