+ 1
Can anyone please help me with this solving this code in Python. I tried a lot but it's not going well.
# I want to calculate and output the percentage of houses that are within one standard deviation from the mean. p = [150000, 125000, 320000, 540000, 200000, 120000, 160000, 230000, 280000, 290000, 300000, 500000, 420000, 100000, 150000, 280000] import numpy as np a=a = np.array([150000, 125000, 320000, 540000, 200000, 120000, 160000, 230000, 280000, 290000, 300000, 500000, 420000, 100000, 150000, 280000]) mean =np.sum(a)/a.size variance=np.sum((a-mean)**2)/a.size sd=np.sqrt(variance) j=mean-sd h=mean+sd n=[] for i in range (len(p)): if a[i]<h and a[i]>j: n.append(p[i]) m=len(n) k=(m/a.size)*100 print(K) p
5 Answers
+ 1
Can you post full task description?
If ranges are includive use <=, >= in place of <, >
is answer 62.5 ?
+ 1
Try Print m instead of k.
is j, h are not inclusives?
+ 1
Thanks for your response
I print k because they asked to output the percentage not the number
j,h are used to mention the condition
+ 1
You are given an array that represents house prices.
Calculate and output the percentage of houses that are within one standard deviation from the mean.
+ 1
This is the full task decription