All problems
Uniform CDF Value
Problem
The uniform CDF on [a, b] is 0 for x < a, (x - a) / (b - a) in between, and 1 for x > b.
Given x, a, and b > a, return the CDF value.
Hint
It rises linearly from zero to one.
Test cases
case 1
in: [0.5,0,1]
expected: 0.5
case 2
in: [0,0,2]
expected: 0
case 3
in: [3,0,2]
expected: 1
Starter codePython
def uniform_cdf_value(x, a, b):
# Your code here
pass3 test cases · run your code against them in the editor