All problems
Interval Coverage Count
Problem
Count how many actual values fall inside their corresponding prediction interval, i.e. lower[t] <= actual[t] <= upper[t].
Return the count as an integer.
Hint
Both bounds are inclusive, so values exactly on a limit still count.
Test cases
case 1
in: [[1,2,3],[0,1,2],[2,3,4]]
expected: 3
case 2
in: [[5,5,5],[1,2,3],[4,4,4]]
expected: 0
case 3
in: [[0,10],[0,10],[0,10]]
expected: 2
case 4
in: [[1,2,3],[1,1,1],[3,3,2]]
expected: 2
Starter codePython
def interval_coverage(actual, lower, upper):
# Your code here
pass4 test cases · run your code against them in the editor