Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-167

Value-Added Estimate

Problem

Return the class gain minus the district gain: (mean(class_post) - mean(class_pre)) - (district_post_mean - district_pre_mean). Return 0.0 when either class list is empty.

Hint

Subtracting the district gain adjusts for the general trend.

Test cases

case 1
in: [[50,60,70],[55,65,80],55,65]
expected: -3.3333333333333286
case 2
in: [[10,20],[15,25],15,25]
expected: -5
case 3
in: [[1,2],[3,4],2,3]
expected: 1
case 4
in: [[100],[110],100,110]
expected: 0
case 5
in: [[],[],5,5]
expected: 0
Starter codePython
def value_added_estimate(class_pre, class_post, district_pre_mean, district_post_mean):
    # Your code here
    pass

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