stochastic programsprobabilityand statistics figure contains version of flipplot that plots coefficients of variation def flipplot (minexpmaxexpnumtrials)"""assumes minexp and maxexp positive intsminexp maxexp numtrials positive integer plots summaries of results of numtrials trials of **minexp to **maxexp coin flips""ratiosmeansdiffsmeansratiossdsdiffssds [][][][ratioscvsdiffscvs [][xaxis [for exp in range(minexpmaxexp )xaxis append( **expfor numflips in xaxisratios [diffs [for in range(numtrials)numheadsnumtails runtrial(numflipsratios append(numheads/float(numtails)diffs append(abs(numheads numtails)ratiosmeans append(sum(ratios)/float(numtrials)diffsmeans append(sum(diffs)/float(numtrials)ratiossds append(stddev(ratios)diffssds append(stddev(diffs)ratioscvs append(cv(ratios)diffscvs append(cv(diffs)numtrialsstring (str(numtrialstrials)title 'mean heads/tails ratiosnumtrialsstring makeplot(xaxisratiosmeanstitle'number of flips''mean heads/tails''bo'logx truetitle 'sd heads/tails ratiosnumtrialsstring makeplot(xaxisratiossdstitle'number of flips''standard deviation''bo'logx truelogy truetitle 'mean abs(#heads #tails)numtrialsstring makeplot(xaxisdiffsmeanstitle'number of flips''mean abs(#heads #tails)''bo'logx truelogy truetitle 'sd abs(#heads #tails)numtrialsstring makeplot(xaxisdiffssdstitle'number of flips''standard deviation''bo'logx truelogy truetitle 'coeff of var abs(#heads #tails)numtrialsstring makeplot(xaxisdiffscvstitle'number of flips''coeff of var ''bo'logx truetitle 'coeff of var heads/tails rationumtrialsstring makeplot(xaxisratioscvstitle'number of flips''coeff of var ''bo'logx truelogy truefigure final version of flipplot