I am tring to find the solution for below question but my result is not matching with the internal validation and it’s falling everytime.
Question: A random variable X is N(mean=25, SD= 4). Find the indicated percentile for X. All the answers are expected to be rounded off to two decimal places.
a. The 10th percentile
b. The 90th percentile
c. The 80th percentile
d. The 50th percentile
I am getting below response after executing my code
import scipy.stats as sts
mu_new = 25 # Mean
sigma_new = 4 # Standard deviation
# The 10th percentile
p10 = round(sts.norm.ppf(0.1, loc=mu_new, scale=sigma_new), 2)
# The 90th percentile
p90 = round(sts.norm.ppf(0.9, loc=mu_new, scale=sigma_new), 2)
# The 80th percentile
p80 = round(sts.norm.ppf(0.8, loc=mu_new, scale=sigma_new), 2)
# The 50th percentile
p50 = round(sts.norm.ppf(0.5, loc=mu_new, scale=sigma_new), 2)
print(p10)
print(p90)
print(p80)
print(p50)
My OutPut:
19.87
30.13
28.37
25.0
I have also read an article very similar to this problem but the test cases are still falling after using solution from this page :
How to compute the percentiles from a normal distribution in python?
When I am running my solution in the graded system, I am getting below error:
incorrect answers p90, p80, p10
Please help on this?
3