Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-339

At Least One Success Independent Trials

Problem

In n independent Bernoulli trials with success probability p, the probability of at least one success is 1 - (1 - p)^n.

Given p and n >= 0, return the probability.

Hint

Complement the all-failure probability.

Test cases

case 1
in: [0.5,3]
expected: 0.875
case 2
in: [0.1,10]
expected: 0.6513215599
case 3
in: [0,100]
expected: 0
Starter codePython
def at_least_one_success_independent_trials(p, n):
    # Your code here
    pass

3 test cases · run your code against them in the editor