Answer:
See attachment for complete program
Explanation:
This imports the random module
import random
The function begins here
def diceTotalScore(a, b, c):
This checks if the outcome of the three dice are the same
if [tex](a == b == c):[/tex]
earnings = 1000 * a --->The earnings for this condition is calculated
This checks if the outcome of two dice are the same
elif [tex]((a == b) or (a == c) or (b == c)):[/tex]
The following sub conditions checks for the outcomes that are the same
if [tex](a == b):[/tex]
[tex]x = a[/tex]
elif [tex](a == c):[/tex]
[tex]x = a[/tex]
elif [tex](b == c):[/tex]
[tex]x = b[/tex]
earnings = 500 * x --->The earnings for this condition is calculated
This checks if no outcome are the same
else:
earnings = 100 * min(a,b,c) --->The earnings for this condition is calculated
The function returns then returns earnings
return earnings
The main begins here
The next three lines simulate the rolls of three dice
a = random.randint(1,6)
b = random.randint(1,6)
c = random.randint(1,6)
This calls the TotalScore function and returns the earnings
print("Earnings: "+str(diceTotalScore(a, b, c)))