All problems
Chebyshev Two Sided Bound
Problem
Chebyshev's inequality bounds P(|X - mu| >= k sigma) by 1 / k^2; expressed with variance it is variance / distance^2 for a distance measured in the same units.
Given the variance and the distance k, return the bound variance / k^2.
Hint
Scale the distance before squaring.
Test cases
case 1
in: [1,2]
expected: 0.25
case 2
in: [4,1]
expected: 4
case 3
in: [2.5,5]
expected: 0.1
Starter codePython
def chebyshev_two_sided_bound(variance, k):
# Your code here
pass3 test cases · run your code against them in the editor