Calculate the probability of observing exactly k events in a fixed interval using the Poisson distribution, given the average rate lambda.
import math
def poisson_probability(lam, k):
probability = (lam ** k) * math.exp(-lam) / math.factorial(k)
return round(probability, 4)