To calculate the probability of having exactly 12 successes in 14 trials with a success rate of 0.6 using the binomial distribution in Python, you can use the `scipy.stats` module. Here's an example of how you can do it: ```python from scipy.stats import binom n = 14 # number of trials p = 0.6 # success rate x = 12 # number of successes probability = binom.pmf(x, n, p) print("The probability of having exactly 12 successes is:", probability) ``` This code uses the `binom.pmf(x, n, p)` function from the `scipy.stats` module to calculate the probability mass function (pmf) for the binomial distribution. The `x` parameter represents the number of successes, `n` is the number of trials, and `p` is the success rate. The output will be the probability of having exactly 12 successes in 14 trials with a success rate of 0.6.
Para escrever sua resposta aqui, entre ou crie uma conta
Compartilhar