0
0
SciPydata~10 mins

Binomial distribution in SciPy - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the binomial distribution function from scipy.stats.

SciPy
from scipy.stats import [1]
Drag options to blanks, or click blank then click option'
Abinom
Bnorm
Cpoisson
Duniform
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the normal distribution function instead of binomial.
Using a distribution unrelated to binomial like poisson or uniform.
2fill in blank
medium

Complete the code to calculate the probability mass function (PMF) for 3 successes in 10 trials with success probability 0.5.

SciPy
prob = binom.pmf([1], 10, 0.5)
Drag options to blanks, or click blank then click option'
A3
B5
C7
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using the total number of trials instead of successes.
Confusing the order of arguments.
3fill in blank
hard

Fix the error in the code to calculate the cumulative distribution function (CDF) for 4 successes in 8 trials with probability 0.3.

SciPy
cdf_value = binom.[1](4, 8, 0.3)
Drag options to blanks, or click blank then click option'
Apdf
Bpmf
Ccdf
Dsf
Attempts:
3 left
💡 Hint
Common Mistakes
Using pmf or pdf instead of cdf.
Using survival function sf which is complementary.
4fill in blank
hard

Fill both blanks to create a dictionary of probabilities for successes greater than 2 in 5 trials with probability 0.4.

SciPy
prob_dict = {k: binom.[1](k, 5, 0.4) for k in range(3, [2])}
Drag options to blanks, or click blank then click option'
Apmf
Bcdf
C6
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using CDF instead of PMF for exact probabilities.
Using 5 as range upper bound which excludes 5.
5fill in blank
hard

Fill all three blanks to create a dictionary of probabilities for successes less than 4 in 7 trials with probability 0.6.

SciPy
probabilities = {k: binom.[1](k, [2], [3]) for k in range(4)}
Drag options to blanks, or click blank then click option'
Apmf
B7
C0.6
Dcdf
Attempts:
3 left
💡 Hint
Common Mistakes
Using CDF instead of PMF for exact values.
Mixing up number of trials or probability values.