All problems
Intervention Pulse Value
Problem
Compute the effect of a pulse intervention at a given distance: pulse_effect * decay^distance.
Return 0.0 for negative distance, since a pulse cannot affect the past.
Hint
A pulse affects one period; the effect then decays geometrically.
Test cases
case 1
in: [10,0.5,0]
expected: 10
case 2
in: [10,0.5,3]
expected: 1.25
case 3
in: [5,1,10]
expected: 5
case 4
in: [10,0.5,-1]
expected: 0
Starter codePython
def intervention_pulse_value(pulse_effect, decay, distance):
# Your code here
pass4 test cases · run your code against them in the editor