import math def f(x, lam): return (math.exp(-lam) * lam**x)/(math.factorial(x)) lam=float(input("Enter the mean:")) p=int(input("Enter the poisson variate:")) poisson=f(p,lam) print("The poisson distribution is:", poisson) import math def poisson_prob(lam, k): return math.pow(lam, k) * math.exp(-lam) / math.factorial(k) lam = 2.5 # average number of events in an interval k = 5 # number of events to consider result = poisson_prob(lam, k) print("The probability of exactly", k, "events in an interval with average", lam, "events is", result)