stochastic programsprobabilityand statistics world series be in order for us to get results that would allow us to reject the null hypothesisi the hypothesis that the teams are evenly matchedthe code in figure simulates instances of series of varying lengthsand plots an approximation of the probability of the better team winning def findserieslength(teamprob)numseries maxlen step def fracwon(teamprobnumseriesserieslen)won for series in range(numseries)if playseries(serieslenteamprob)won + return won/numseries winfrac [xvals [for serieslen in range( maxlenstep)xvals append(serieslenwinfrac append(fracwon(teamprobnumseriesserieslen)pylab plot(xvalswinfraclinewidth pylab xlabel('length of series'pylab ylabel('probability of winning series'pylab title(str(round(teamprob )probability of better team winning game'pylab axhline( #draw horizontal line at yanksprob philsprob findserieslength(yanksprob/(yanksprob philsprob)figure how long should the world series bethe output of findserieslength suggests that under these circumstances the world series would have to be approximately games long before we could reject the null hypothesis and confidently say that the better team had almost certainly won scheduling series of this length might present some practical problems