Calculating quartiles

#n= int(input())
a=np.array([3,7,8,5,12,14,21,13,18])
b=sorted(a)
q1=np.percentile(b,25)
q2=np.percentile(b,50)
q3=np.percentile(b,75)
print(q1,q2,q3)```

i am getting =7.0 12.0 14.0
but answer is=6,12,16 according to [hackerranker](https://www.hackerrank.com/challenges/s10-quartiles/problem?h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen)

where am I missing the logic

Hi @Bharath_Varma,
Numpy uses somewhat different way to compute percentiles, whereas hackerrank is using the formula as discussed in the course.
It would be better if you try to implement it from yourself on a list rather than using numpy function.