[Tutor] Statistics with python

Mariam Haji mariamhaji01 at gmail.com
Sat Oct 13 04:32:09 EDT 2018

Hi guys,

I have a statistics question where I am to calculate the probability of a
sample dataset.

I have done the coding bit but I am not sure if I did the right thing, I
just need confirmation before I submit it.

the question is as:
If a sample of 50 patients is taken from a dataset what is the probability
that we will get a patient above the age of 56?

So I know my sample mean is 50 and my no is 56
to get std I manually did 50/√56 (that's 50/square root of 56) I got the
answer as 6.66

So my mean is 50 and std is 6.66

Then I did the below to get the z score and probability using scipy.stats
as st


z1 = (56-m)/s

p1 = st.norm.sf(z1)
print ('Probability of patient above the age of 56 is:', (p1))

Probability of patient above the age of 56 is: 0.183820506093897

Am i missing something or did I do it right?

Thanks in Advance.


More information about the Tutor mailing list