# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt

n=7

p=.6

k=np.arange(0,8)
k

binomial = stats.binom.pmf(k,n,p)

binomial

plt.plot(k,binomial,'o-')
plt.title('Binomial: n=%i , p=%.2f' % (n,p), fontsize=15)
plt.xlabel('Number of Successes')
plt.ylabel('Probability of Successes')
plt.show()

n=len(binomial)

n

sum(binomial)



StarcoderdataJupyterScriptsDedupFiltered