Bird
0
0

What is the output of this code?

medium📝 Predict Output Q4 of 15
SciPy - Statistical Functions (scipy.stats) Basics
What is the output of this code?
from scipy.stats import poisson
rv = poisson(3)
print(round(rv.pmf(2), 4))
A0.4481
B0.0498
C0.1494
D0.2240
Step-by-Step Solution
Solution:
  1. Step 1: Calculate Poisson PMF for k=2, \( \mu=3 \)

    PMF formula: \( P(k) = \frac{e^{-\mu} \mu^k}{k!} = \frac{e^{-3} 3^2}{2!} \approx 0.2240 \)
  2. Step 2: Confirm rounding and output

    Using scipy's pmf method and rounding to 4 decimals gives 0.2240.
  3. Final Answer:

    0.2240 -> Option D
  4. Quick Check:

    PMF(2,3) = 0.2240 [OK]
Quick Trick: Use pmf(k) to get exact probability [OK]
Common Mistakes:
MISTAKES
  • Confusing pmf with cdf
  • Incorrect factorial calculation
  • Rounding errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes