Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Сhallenge 2 | Normal Distribution
Probability Theory

book
Сhallenge 2

Here we are going to work with the distribution from the previous chapter!

Tarefa

Swipe to start coding

Please calculate the probability that your cat's weight will be unusual!

  1. Import norm object.

  2. Calculate the first one prob_1 that your cat's weight will be less than 2 kg with such parameters:

    • Mean equals 4.2
    • Standard deviation equals 1.
  3. Calculate the second one prob_2 that the weight of your cat will be more than 11 kg with the parameters:

    • Mean equals 4.2
    • Standard deviation equals 1.
  4. Calculate the probability that the weight of your cat will be more than 11 or less than 2 kg.

Compare it to the graph and the values of confidence intervals.

Solução

# Import norm object
from scipy.stats import norm

# Calculate the first probability
prob_1 = norm.cdf(x = 2, loc = 4.2, scale = 1)
# Calculate the second probability
prob_2 = norm.sf(x = 11, loc = 4.2, scale = 1)
# Calculate the whole probability
prob = prob_1 + prob_2

print("The probability is", prob)

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 5. Capítulo 3
# Import norm object
from ___

# Calculate the first probability
prob_1 = ___(x = 2, loc = ___, scale = ___)
# Calculate the second probability
prob_2 = norm.___(x = ___, loc = ___, scale = ___)
# Calculate the whole probability
prob = ___

print("The probability is", prob)
toggle bottom row
some-alt