All problems
Fill Rate
Problem
Compute the fill rate as 1 - backorders / total_demand.
Return 1.0 when total_demand is non-positive.
Hint
The fill rate is the share of demand met without backorder.
Test cases
case 1
in: [100,5]
expected: 0.95
case 2
in: [50,0]
expected: 1
case 3
in: [200,50]
expected: 0.75
case 4
in: [0,0]
expected: 1
Starter codePython
def fill_rate(total_demand, backorders):
# Your code here
pass4 test cases · run your code against them in the editor