All problems
Uniform Distribution Variance
Problem
The variance of a uniform distribution on [a, b] is (b - a)^2 / 12.
Given a and b, return the variance.
Hint
The width squared sets the scale.
Test cases
case 1
in: [0,1]
expected: 0.08333333333333333
case 2
in: [-2,2]
expected: 1.3333333333333333
case 3
in: [3,6]
expected: 0.75
Starter codePython
def uniform_distribution_variance(a, b):
# Your code here
pass3 test cases · run your code against them in the editor