Challenge
Oppgave
Swipe to start coding
Let's assume that we want to conduct an experiment to determine the probability that a person has more than 3 cats, let's consider that we have asked 1000 people (they can answer yes or no). Follow the algorithm:
- Import
binom
object. - Calculate the probability that more than
200
people answeredyes
to your question among1000
that were interviewed. The probability of receiving a positive answer is0.3
or30%
.
Løsning
99
1
2
3
4
5
6
7
8
9
10
# Import binom object
from scipy.stats import binom
import numpy as np
np.random.seed(2000)
# Calculate the probability
prob = binom.sf(k = 200, n = 1000, p = 0.3)
# Print the probability
print("The probability is", prob)
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 5
single
99
1
2
3
4
5
6
7
8
9
10
# Import binom object
___
import numpy as np
np.random.seed(2000)
# Calculate the probability
prob = ___(___)
# Print the probability
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