Lesson 8 of 15
Continuous Random Variables
Density Instead of Mass
A continuous random variable is described by a probability density function (PDF) , where:
Note that for any single point — only intervals have positive probability.
Cumulative Distribution Function
The Uniform Distribution
assigns equal density to every point in :
a, b = 0, 1
mean = (a + b) / 2
var = (b - a)**2 / 12
print(round(mean, 4)) # 0.5
print(round(var, 4)) # 0.0833
Your Task
Implement uniform_stats(a, b) that prints and of , each rounded to 4 decimal places.
Pyodide loading...
Loading...
Click "Run" to execute your code.