All problems
Safety Stock Periodic Review
Problem
Compute safety stock under periodic review: z * sigma_demand * sqrt(lead_time + review_period), where z is the service-level multiplier and sigma_demand the per-period demand standard deviation.
Return 0.0 when the protection interval is negative.
Hint
The review period extends the exposure window beyond the lead time alone.
Test cases
case 1
in: [1.65,2,3,1]
expected: 6.6
case 2
in: [2,1,4,0]
expected: 4
case 3
in: [1,3,0,2]
expected: 4.242640687119286
case 4
in: [1.96,0,5,5]
expected: 0
Starter codePython
def safety_stock_periodic_review(z, sigma_demand, lead_time, review_period):
# Your code here
pass4 test cases · run your code against them in the editor