0
0
SciPydata~20 mins

Poisson distribution in SciPy - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Poisson Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of Poisson PMF Calculation
What is the output of this code that calculates the Poisson probability mass function (PMF) for k=3 events with an average rate (lambda) of 2?
SciPy
from scipy.stats import poisson
result = poisson.pmf(3, 2)
print(round(result, 4))
A0.1804
B0.2707
C0.1353
D0.2240
Attempts:
2 left
💡 Hint
Recall the Poisson PMF formula: P(k; λ) = (λ^k * e^-λ) / k!
data_output
intermediate
2:00remaining
Number of Events with High Probability
Using a Poisson distribution with λ=4, how many events (k) have a probability mass function (PMF) value greater than 0.1? Use k values from 0 to 10.
SciPy
from scipy.stats import poisson
pmf_values = [poisson.pmf(k, 4) for k in range(11)]
count = sum(p > 0.1 for p in pmf_values)
print(count)
A5
B4
C6
D7
Attempts:
2 left
💡 Hint
Calculate PMF for k=0 to 10 and count how many exceed 0.1.
visualization
advanced
3:00remaining
Plotting Poisson PMF for Different Lambda Values
Which option produces a plot showing Poisson PMF curves for λ=2, 4, and 6 over k=0 to 10?
SciPy
import matplotlib.pyplot as plt
from scipy.stats import poisson
import numpy as np
k = np.arange(0, 11)
lambdas = [2, 4, 6]
for lam in lambdas:
    plt.plot(k, poisson.pmf(k, lam), marker='o', label=f'λ={lam}')
plt.xlabel('Number of events (k)')
plt.ylabel('PMF')
plt.title('Poisson PMF for different λ')
plt.legend()
plt.grid(True)
plt.show()
APlots a single curve with λ=4 only, ignoring others.
BPlots three identical flat lines at y=1 for all k values.
CPlots three curves with peaks shifting right as λ increases, all between 0 and 1 on y-axis.
DRaises a NameError due to missing import of numpy.
Attempts:
2 left
💡 Hint
Check if all λ values are plotted and curves shift right with increasing λ.
🧠 Conceptual
advanced
1:30remaining
Understanding Poisson Distribution Assumptions
Which statement correctly describes a key assumption of the Poisson distribution?
AThe distribution models continuous data with normal shape.
BEvents occur in fixed intervals with increasing probability over time.
CEvents are dependent and occur in clusters.
DEvents occur independently and the average rate is constant over time.
Attempts:
2 left
💡 Hint
Think about how events happen in a Poisson process.
🔧 Debug
expert
1:30remaining
Identify the Error in Poisson PMF Calculation Code
What error does this code produce when calculating Poisson PMF for k=3 and λ='2' (string instead of number)?
SciPy
from scipy.stats import poisson
result = poisson.pmf(3, '2')
print(result)
ANo error, prints a valid probability
BTypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
CValueError: lambda must be positive
DSyntaxError: invalid syntax
Attempts:
2 left
💡 Hint
Check the data type of lambda parameter and how pow() behaves with strings.