All problems
Exponential PDF
Problem
Exponential probability density function evaluated at x.
f(x) = lam * e^(-lam * x) for x >= 0 and 0 otherwise. Return 0.0 for negative lam.
Test cases
case 1
in: [1,0]
expected: 1
case 2
in: [2,1]
expected: 0.2706705664732254
case 3
in: [0.5,4]
expected: 0.06766764161830635
case 4
in: [1,-1]
expected: 0
Starter codePython
import math
def exponential_pdf(lam, x):
# Your code here
pass4 test cases · run your code against them in the editor