All problems
Promotion Feature Effect
Problem
Apply a promotion lift to base demand: base_demand * (1 + lift * promo_flag).
promo_flag is 0 or 1, so the lift only applies during promotions. Return the adjusted demand.
Hint
A negative lift models a cannibalization or price increase effect.
Test cases
case 1
in: [100,0.2,1]
expected: 120
case 2
in: [100,0.2,0]
expected: 100
case 3
in: [0,0.5,1]
expected: 0
case 4
in: [50,-0.1,1]
expected: 45
Starter codePython
def promotion_feature_effect(base_demand, lift, promo_flag):
# Your code here
pass4 test cases · run your code against them in the editor