monte carlo simulation class crapsgame(object)def __init__(self)self passwinsself passlosses ( , self dpwinsself dplossesself dppushes ( , , def playhand(self)throw rolldie(rolldie(if throw = or throw = self passwins + self dplosses + elif throw = or throw = or throw = self passlosses + if throw = self dppushes + elseself dpwins + elsepoint throw while truethrow rolldie(rolldie(if throw =pointself passwins + self dplosses + break elif throw = self passlosses + self dpwins + break def passresults(self)return (self passwinsself passlossesdef dpresults(self)return (self dpwinsself dplossesself dppushesfigure crapsgame class figure contains function that uses class crapsgame its structure is typical of many simulation programs it runs multiple games (think of each game as analogous to trial in our earlier simulationsand accumulates the results each game includes multiple handsso there is nested loop it then produces and stores statistics for each game finally it produces and outputs summary statistics in this caseit prints the expected return on investment (roior each kind of betting line and the standard deviation of that roi return on investment is defined by the equation !"!"#!"#!"#$%&'$"!"#!!"#$%&'$"!"#!!"#$%&'$"since the pass and don' pass lines pay even money (if you bet $ and winyou gain is $ )the roi is !"!"#$%!!"#!"#$%!!"##$!"#$%!!"#