Skip to content
DeepForgeby svx
All problems
EasyProbabilitypr-008

Complement Probability

Problem

Return the probability of the complement of an event given its probability p.

P(not A) = 1 - p. Assume 0 <= p <= 1.

Hint

The two probabilities always add to 1.

Test cases

case 1
in: [0.3]
expected: 0.7
case 2
in: [0]
expected: 1
case 3
in: [1]
expected: 0
case 4
in: [0.125]
expected: 0.875
Starter codePython
def complement_probability(p):
    # Your code here
    pass

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