Skip to content
DeepForgeby svx
All problems
EasyML Fundamentalsml-249

Interval Sharpness

Problem

Compute the mean interval width (upper - lower).

Empty input returns 0.0.

Hint

Sharper intervals are more informative when coverage is maintained.

Test cases

case 1
in: [[[0,1],[2,4]]]
expected: 1.5
case 2
in: [[[0,2]]]
expected: 2
case 3
in: [[]]
expected: 0
Starter codePython
def interval_sharpness(intervals):
    # Your code here
    pass

3 test cases · run your code against them in the editor