### This Python program plots the binomial probability mass function three ### times with different parameter values on the same scales. ### Plot the Binomial, use the stats fuction from scipy import numpy as np import matplotlib.pyplot as plt from scipy.stats import binom n = 10 p = 0.5 x = np.arange(0,n+1) y = binom.pmf(x,n,p) plt.plot(x,y,'o-') plt.title('Binomial PMF: n = 10, p = 0.5') plt.xlabel('Number of Heads') plt.ylabel('Probability') plt.show() n = 10 p = 0.25 x = np.arange(0,n+1) y = binom.pmf(x,n,p) plt.plot(x,y,'o-') plt.title('Binomial PMF: n = 10, p = 0.25') plt.xlabel('Number of Heads') plt.ylabel('Probability') plt.show() n = 10 p = 0.75 x = np.arange(0,n+1) y = binom.pmf(x,n,p) plt.plot(x,y,'o-') plt.title('Binomial PMF: n = 10, p = 0.25') plt.xlabel('Number of Heads') plt.ylabel('Probability') plt.show()