Question: In Python , write a function, score_dice(dice rolls), which returns the game score of the list, dice_rolls, using the following scheme: a one is worth
In Python, write a function, score_dice(dice rolls), which returns the game score of the list, dice_rolls, using the following scheme:
a one is worth 10 points
a two is worth 9 points
a three is worth 8 points
a four is worth 7 points
a five is worth 6 points
a six is worth 5 points
The game score is the sum of the points of the rolls. Use a helper function, points_of(dice_roll), which returns the points for a dice_roll of 1,2,3,4,5,6.
Example:
for dice_roll in range(1,7):
print(dice_roll, 'is worth',points_of(dice_roll))
1 is worth 10
2 is worth 9
3 is worth 8
4 is worth 7
5 is worth 6
6 is worth 5
>>>
dice_rolls = roll_dice_repeat(7)
game_score = score_dice(dice_rolls)
print('The result of 7 fice rolls is',dice_rolls)
print('and the resulting points obtained are',game_score)
The result of 7 fice rolls is [4,1,5,6,5,3,2]
and the resulting points obtained are 51
>>>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
