In: Computer Science
Yahtzee Simulation. Must be written in Python
These are the specific instructions:
"Write a function called Yahtzee_Simulation() that receives no parameters. The function will simulate rolling 5 dice at least one million times. It will keep track of the number of times the computer rolls a Yahtzee. The function will return the number of wins divided by the number of tries. There are no print() statements in this function.
Write a function called main() that receives no parameters. This function calls the Yahtzee_Simulation() function 10 times and prints the result of each simulation. Finally, print the mathematical result, which can be calculated with the following code: print(6/(6**5))"
This was also given as a hint:
The simulation runs 1000000 times 0.000774 0.000788 0.000729 0.000761 0.000777 0.000777 0.000777 0.000758 0.00077 0.000768 The mathematical solution is: 0.0007716049382716048
I've been struggling on how to do this, I think seeing an example of what it does and how it's made will help me when making my own, Thank you!

code:
import random
def yahtzee_simulation():
#roll 5 6-faced dices
wins = 0
#simulate one million times
for i in range(1000000):
#roll 5 dices,
dice1 = random.randint(1,7)
dice2 = random.randint(1,7)
dice3 = random.randint(1,7)
dice4 = random.randint(1,7)
dice5 = random.randint(1,7)
#check for a yahtzee
if dice1 == dice2 == dice3 == dice4 == dice5:
wins+=1
#return the probability
return wins/1000000
def main():
#simulate 10 times
for i in range(10):
print(yahtzee_simulation())
print("The mathematical solution is : ",6/(6**5))
main()