All problems
Empirical CDF at Point
Problem
Return the fraction of values in data that are less than or equal to x. Return 0.0 for empty data.
Hint
Count values <= x and divide by n.
Test cases
case 1
in: [[1,2,3,4],2.5]
expected: 0.5
case 2
in: [[1,2,3,4],4]
expected: 1
case 3
in: [[1,2,3,4],0]
expected: 0
case 4
in: [[5,5,5],5]
expected: 1
case 5
in: [[],1]
expected: 0
Starter codePython
def ecdf(data, x):
# Your code here
pass5 test cases · run your code against them in the editor