import numpy as np
import scipy.stats as st
import matplotlib.pyplot as pltPoisson examples from https://roualdes.us/lecturenotes/poisson
# 1.
P = st.poisson(3.5) # random variable with rate parameter# a.
P.pmf(2) # density function, probability mass function0.18495897346170082
# b.
1 - np.sum(P.pmf(np.arange(3)))0.6791528011378659
# c.
P = st.poisson(3.5 * 7) # average per week
np.sum(P.pmf(np.arange(6)))2.091682196839196e-06