binom.pmf evaluates the probability mass function for a binomial distribution: given k successes, n independent trials, and success probability p, it returns the corresponding probability. It replaces direct factorial-and-power arithmetic with a SciPy statistics API call. section 3.1.2
Probability of seven successes
With n = 20 trials, k = 7 successes, and p = 0.2, calculate and format the result: `probability = binom.pmf(7, 20, 0.2)`; multiplying by 100 gives approximately 5.455%. The same inputs can be compared with the direct binomial formula. section 3.1.2
>>> from scipy.stats import binom >>> pmf = binom.pmf(k, n, p[i])
Use the compact vectorized call `binom.pmf(k, n, p[i])` to evaluate probabilities across success counts and compare distributions with plotting code. section 3.1.2
