Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.


Learn live

Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.

Upcoming live events

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.

Search from all Lessons

LoginGet Started
← Back to Lessons
Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge
Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast
Edit on Github
Open in Colab

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 [ ]:
In [ ]:

In [ ]:
#P(n > 14)