Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-161

Item Discrimination

Problem

Return the discrimination index: the proportion answering the item correctly in the top n_each examinees by total score minus that proportion in the bottom n_each. Return 0.0 when n_each <= 0, 2*n_each exceeds n, or lengths differ.

Hint

High-achieving examinees should get the item right more often.

Test cases

case 1
in: [[1,1,1,0,0,0],[6,5,4,3,2,1],2]
expected: 1
case 2
in: [[0,0,0,1,1,1],[6,5,4,3,2,1],2]
expected: -1
case 3
in: [[1,0,1,0,1,0],[5,4,3,2,1,0],2]
expected: 0
case 4
in: [[1,1,1,1],[1,2,3,4],1]
expected: 0
case 5
in: [[1,0],[1,2],2]
expected: 0
Starter codePython
def item_discrimination(item_scores, total_scores, n_each):
    # Your code here
    pass

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