Challenge - 5 Problems
Normal Distribution Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
Output of Normal Distribution PDF Calculation
What is the output of this code that calculates the probability density function (PDF) of a normal distribution at x=0 with mean=0 and standard deviation=1?
SciPy
from scipy.stats import norm result = norm.pdf(0, loc=0, scale=1) print(round(result, 4))
Attempts:
2 left
💡 Hint
Recall the formula for the normal distribution PDF at the mean.
✗ Incorrect
The PDF of a standard normal distribution at its mean (0) is 1 divided by the square root of 2π, approximately 0.3989.
❓ data_output
intermediate2:00remaining
Number of Samples within One Standard Deviation
Using scipy, generate 1000 samples from a normal distribution with mean=5 and std=2. How many samples fall between 3 and 7 (within one standard deviation)?
SciPy
import numpy as np from scipy.stats import norm samples = norm.rvs(loc=5, scale=2, size=1000, random_state=42) count = np.sum((samples >= 3) & (samples <= 7)) print(count)
Attempts:
2 left
💡 Hint
Recall the empirical rule for normal distributions.
✗ Incorrect
About 68% of data in a normal distribution lies within one standard deviation from the mean. 68% of 1000 is about 680.
❓ visualization
advanced2:30remaining
Plotting Normal Distribution PDF with Different Parameters
Which option produces a plot showing two normal distribution curves: one with mean=0, std=1 and another with mean=2, std=0.5?
SciPy
import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm x = np.linspace(-3, 5, 500) plt.plot(x, norm.pdf(x, 0, 1), label='mean=0, std=1') plt.plot(x, norm.pdf(x, 2, 0.5), label='mean=2, std=0.5') plt.legend() plt.show()
Attempts:
2 left
💡 Hint
Check the parameters passed to norm.pdf for each curve.
✗ Incorrect
The code plots two normal PDFs with different means and std deviations, resulting in two distinct bell curves.
🧠 Conceptual
advanced1:30remaining
Understanding the Effect of Standard Deviation on Normal Distribution Shape
Which statement correctly describes how increasing the standard deviation affects the shape of a normal distribution?
Attempts:
2 left
💡 Hint
Think about how spread relates to standard deviation.
✗ Incorrect
Increasing standard deviation spreads data out, making the bell curve wider and lower in height.
🔧 Debug
expert2:00remaining
Identify the Error in Normal Distribution Sampling Code
What error does this code raise when trying to generate samples from a normal distribution?
import numpy as np
from scipy.stats import norm
samples = norm.rvs(loc=0, scale=-1, size=100)
print(samples)
SciPy
import numpy as np from scipy.stats import norm samples = norm.rvs(loc=0, scale=-1, size=100) print(samples)
Attempts:
2 left
💡 Hint
Check the scale parameter value passed to norm.rvs.
✗ Incorrect
The scale (standard deviation) must be positive. Negative scale causes ValueError.