0
0
SciPydata~10 mins

Probability density and cumulative functions 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 normal distribution from scipy.stats.

SciPy
from scipy.stats import [1]
Drag options to blanks, or click blank then click option'
Astats
Bnormal
Cnorm
Ddistribution
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'normal' instead of 'norm' causes import errors.
Importing 'stats' or 'distribution' is incorrect for normal distribution.
2fill in blank
medium

Complete the code to calculate the probability density function (PDF) at x=0 for a standard normal distribution.

SciPy
pdf_value = norm.[1](0)
Drag options to blanks, or click blank then click option'
Appf
Bcdf
Cpmf
Dpdf
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cdf' instead of 'pdf' returns cumulative probability, not density.
Using 'pmf' is for discrete distributions, not normal distribution.
3fill in blank
hard

Fix the error in the code to compute the cumulative distribution function (CDF) at x=1.5.

SciPy
cdf_value = norm.[1](1.5)
Drag options to blanks, or click blank then click option'
Apdf
Bcdf
Cppf
Drvs
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pdf' returns density, not cumulative probability.
Using 'ppf' returns quantiles, not cumulative probability.
4fill in blank
hard

Fill both blanks to create a dictionary of PDF values for x in [0, 1, 2] where PDF is greater than 0.1.

SciPy
pdf_dict = {x: norm.[1](x) for x in [0, 1, 2] if norm.[2](x) > 0.1}
Drag options to blanks, or click blank then click option'
Apdf
Bcdf
Crvs
Dppf
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cdf' in the filter returns cumulative probabilities, not densities.
Using 'rvs' or 'ppf' are unrelated to density calculation.
5fill in blank
hard

Fill all three blanks to create a dictionary of cumulative probabilities for x in [0, 1, 2] where the cumulative probability is less than 0.9.

SciPy
cdf_dict = {x[1]2: norm.[2](x) for x in [0, 1, 2] if norm.[3](x) < 0.9}
Drag options to blanks, or click blank then click option'
A*
Bcdf
C<
D**
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication (*) instead of exponentiation (**) for keys.
Using 'pdf' instead of 'cdf' for cumulative probabilities.