All problems
Poisson PMF
Problem
Poisson probability mass function with rate lam.
P(X = k) = lam^k * e^(-lam) / k!. Return 0.0 if lam < 0 or k < 0.
Test cases
case 1
in: [2,0]
expected: 0.1353352832366127
case 2
in: [2,3]
expected: 0.1804470443154836
case 3
in: [1,5]
expected: 0.0030656620097620196
case 4
in: [3,-1]
expected: 0
Starter codePython
import math
def poisson_pmf(lam, k):
# Your code here
pass4 test cases · run your code against them in the editor