+ 1
Basketball players python data science solved, explain
Original attempt that was wrong: https://sololearn.com/discuss/3027016/?ref=app After looking through questions I found this code and used it it worked. P=[180, 172, 178, 185, 190, 195, 192, 200, 210, 190] Mean=sum(p)/len(p) stdvar=(sum(v-mean)**2 for v in p)/len(p))**0.5 low, high = mean-stdvar, mean+stdvar Count=len([v for v in p if low <v<high]) Print(count) I used that for the project so I can move on but can someone pls explain it to me by breaking it down so I can have it for my notes? Ty
1 Antwort
+ 1
I'll try to explain whatever I have understood. Question says that we have to find how many heights are one standard deviation from the mean. Data is usually skewed about mean. Thus standard deviation is the measure of the amount of how much it is deviated from the mean. In the first step we calculate the mean and in the second standard deviation of given data. After that low and high are the limits within which the points are to be found if they lie within that range. Count simply return that total amount of height within that range(low to high). Since question is asked to find how many height are one standard deviation from mean thus we are considering lower and higher, if it was asked to find above or below then only addition or subtraction would be taken respectively.