All problems
Option Termination Probability
Problem
Compute the probability that an option with per-step termination probability beta has ended after a number of steps.
Return 1 - (1 - beta)^steps. Non-positive steps or beta give 0.0 and beta at least 1 gives 1.0.
Hint
Termination is geometric, so survival decays as (1 - beta) per step.
Test cases
case 1
in: [0.1,1]
expected: 0.09999999999999998
case 2
in: [0.5,3]
expected: 0.875
case 3
in: [0,10]
expected: 0
case 4
in: [1,5]
expected: 1
case 5
in: [0.2,0]
expected: 0
Starter codePython
def option_termination_probability(beta, steps):
# Your code here
pass5 test cases · run your code against them in the editor