Skip to content
DeepForgeby svx
All problems
EasyProbabilitypr-065

Markov Bound

Problem

Markov's inequality upper bound on P(X >= a) for a nonnegative random variable with the given mean:

P(X >= a) <= min(1, mean / a).

Return 1.0 when a <= 0.

Hint

The bound is only useful when it is below 1.

Test cases

case 1
in: [2,4]
expected: 0.5
case 2
in: [1,1]
expected: 1
case 3
in: [3,1]
expected: 1
case 4
in: [0,5]
expected: 0
Starter codePython
def markov_bound(mean, a):
    # Your code here
    pass

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