Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-033

Poisson CDF

Problem

Poisson cumulative distribution function P(X <= k) with rate lam.

Sum lam^i * e^(-lam) / i! for i from 0 to k. Return 0.0 if lam < 0 or k < 0.

Test cases

case 1
in: [2,0]
expected: 0.1353352832366127
case 2
in: [2,2]
expected: 0.6766764161830635
case 3
in: [3,10]
expected: 0.9997076630493528
case 4
in: [1,-1]
expected: 0
case 5
in: [0,0]
expected: 1
Starter codePython
import math


def poisson_cdf(lam, k):
    # Your code here
    pass

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