Сhallenge 2
Here we are going to work with the distribution from the previous chapter!
Oppgave
Swipe to start coding
Please calculate the probability that your cat's weight will be unusual!
-
Import
norm
object. -
Calculate the first one
prob_1
that your cat's weight will be less than2
kg with such parameters:- Mean equals
4.2
- Standard deviation equals
1
.
- Mean equals
-
Calculate the second one
prob_2
that the weight of your cat will be more than11
kg with the parameters:- Mean equals
4.2
- Standard deviation equals
1
.
- Mean equals
-
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.
Løsning
99
1
2
3
4
5
6
7
8
9
10
11
# 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)
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 5. Kapittel 3
single
99
1
2
3
4
5
6
7
8
9
10
11
# 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)
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår