Explore Library
Code QuizIntermediate

Bernoulli and Binomial Probability

Identify the exponent mistake in this binomial probability mass function.

Codepython
from math import comb

def binomial_pmf(k, n, p):
    # Probability of exactly k successes in n trials
    return comb(n, k) * (p ** k) * ((1 - p) ** n)

print(binomial_pmf(2, 5, 0.5))

What is the bug in this binomial PMF function?