All problems
Cumulative Churn Rate
Problem
Compute the cumulative churn rate from monthly churn rates: 1 - product(1 - rate_i). Empty input returns 0.0.
Hint
Churn compounds: surviving each month requires surviving every earlier month too.
Test cases
case 1
in: [[0.1,0.1]]
expected: 0.18999999999999995
case 2
in: [[0.5,0.5]]
expected: 0.75
case 3
in: [[]]
expected: 0
case 4
in: [[1,0.2]]
expected: 1
Starter codePython
def cumulative_churn(monthly_churn_rates):
# Your code here
pass4 test cases · run your code against them in the editor