lundi 30 mars 2020

Python probability from sample

Here's what I'd like to do : There's 47% of girls amongst a population of 200 people. After choosing a random sample of 24 persons, I have to find the probability of having between 6 to 9 girls in that sample. I've been trying many ways but each of them just turn out wrong!

Could you help me out using NUMPY and LOOP?

Here's what I did :

import numpy as np 

population=np.random.choice(np.arange(0,2),size=200, p=[0.53, 0.47])

and I just don't know how to create a loop like : "for in range(6,9)" from my 24 persons sample ?

Thanks :)




Aucun commentaire:

Enregistrer un commentaire