Write a program that performs a simulation to estimate the p
Solution
from random import randrange
def main():
printIntro()
times = getInput()
foak = rollNtimes(times)
printsummary(foak,times)
def printIntro():
print(\' \' \' A Dice Simulation to check probability to getting five of a kind in single roll,\' \' \')
def getInput():
times = eval(input(\'\ how many times you want to roll the dices: \'))
return times
def rollNtimes(times):
foak= 0
for i in range(times):
result= rollOneTime()
foak = diceCheck(result,foak)
return foak
def rollOneTime():
result = \'no\'
i = 0
x = diceRandom()
while diceRandom() == x:
i = i+1
if i == 4:
result = \'yes\'
return result
def diceCheck(result,foak):
if result == \'yes\':
foak = foak+1
return foak
def diceRandom():
x = randrange(1,7)
return x
def printSummary(foak,times):
print(\'\ For {} times we get FOAK {} which is {:0.2%}\'. format(times,foak,foak/times))
if __ name__==\'__main__\' : main()

