Write an Object Oriented Program that performs a simulation
Solution
from random import randrange
 
 def main():
     msg()
     chances = getInput()
     foak = rollNtimes(chances)
     printSummary(foak,chances)
 
 
 def msg():
     print(\'\'\'A Dice Simulation to check probability rolling five-of-a-kind in single roll.\'\'\')
 
 
 #ask how many times to simulate rolling dices
 def getInput():
     number = eval(raw_input(\'\  Please enter no.of times you want to roll the dices: \'))
     return number
 
 
 def rollNtimes(chances):
    
     foak = 0
     #roll to the no.of times limit
     for i in range(chances):
        
         result = rollOneTime()   
         foak = diceCheck(result,foak)
    
     return foak
 
 
 #running each times roll all the dices
 def rollOneTime():
    
     result = \'no\'
     i = 0
    
     #first dice stop rolling.
     x = diceRandom()
    
   
     while diceRandom() == x:
         i = i+1
    
     #if all 5 dices has the same value store result  
     if i == 4:
         result = \'yes\'
 
     return result
 
 
 #checking if the result get five-of-a-kind
 def diceCheck(result,foak):
    
     if result == \'yes\':
         foak = foak+1
 
     return foak
 
 #random dice whice has value between 1-6
 def diceRandom():  
     x = randrange(1,7)
     return x
 def printSummary(foak,times):
     print(\'\ For {} times we get FOAK {} times which is {:0.2%}\'.format(times,foak,foak/times))
 main()


