4Geeks logo
About us

Learning library

For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.

It makes sense to start learning by reading and watching videos about fundamentals and how things work.

Data Science and Machine Learning - 16 wks

Full-Stack Software Developer - 16w

Search from all Lessons

Social & live learning

The most efficient way to learn: Join a cohort with classmates just like you, live streams, impromptu coding sessions, live tutorials with real experts, and stay motivated.

← Back to Lessons
Edit on Github
Open in Collab

Binomial Distribution With Python

Probability Mass Function: Binomial Distribution

f(k,n,p)=Pr(k;n,p)=Pr(X=k)=(nk)pk(1p)nk\displaystyle f(k,n,p)=\Pr(k;n,p)=\Pr(X=k)={\binom {n}{k}}p^{k}(1-p)^{n-k}

for k=0,1,2,...,nk = 0, 1, 2, ..., n.

In [ ]:
#determine distribution
#consider 10 free throw attempts with p = .5
In [ ]:
#plot probability
In [ ]:
#probability of 6 successes?
In [ ]:
#probability of at least 6 made?
In [ ]:
#with cumulative distribution function
In [ ]:
#Example 2: p = 0.8, n = 20
In [ ]:
#P(10)
In [ ]:

In [ ]:
#P(n > 14)