Session Ready
Exercise

Binomial distribution

As we touched on in the slides, the binomial distribution is used to model the number of successful outcomes in trials where there is some consistent probability of success.

For this exercise, consider a game where you are trying to make a ball in a basket. You are given 10 shots and you know that you have an 80% chance of making a given shot. To simplify things, assume each shot is an independent event.

Instructions
100 XP
  • Generate some data for the distribution using the rvs() function with size set to 1000; assign it to the data variable.
  • Display a matplotlib histogram; examine the shape of the distribution.
  • Assign the probability of making 8 or less shots to prob1 and print the result.
  • Assign the probability of making all 10 shots to prob2 and print the result.