Skip to content
DeepForgeby svx
All problems
HardStatisticsst-380

Number Needed to Treat Point

Problem

The number needed to treat is the reciprocal of the absolute risk difference: 1 / |risk_treated - risk_control|.

Given the two risks (not equal), return the number needed to treat.

Hint

Take the absolute difference so the direction of benefit does not matter.

Test cases

case 1
in: [0.1,0.2]
expected: 10
case 2
in: [0.05,0.1]
expected: 20
case 3
in: [0.3,0.25]
expected: 20.000000000000004
Starter codePython
def number_needed_to_treat_point(risk_treated, risk_control):
    # Your code here
    pass

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