help with programing question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

help with programing question

hi can someone help me with programming question. I have been taking programming classes but doesn't feel like i'm actually learning and completely stuck on this question. If can answer this question it be very appreciated. Your software company has been contracted to write a prototype program to perform simple statistical evaluations of integer data. Your program needs to implement the following functions: def calcMean (scores, count) // Where scores is an an array/list of integers and // count is the number of items in the array // mean is essentially the same as the average. // return the mean of the data in scores as a float def calcMedian (scores, count) // Calculate the median value for the data in scores // Median is middle value if the number of items is odd // or the average of the middle two values if the number // of items is even. def calcVariance (scores, count) // Calculate the variance value for the data in scores // variance is determined using the formula: Formula: the sum of the square of the values / count - square of the sum of the values / square of the count def calcStdDev (variance) // Calculate the standard deviation value for the data in scores // standard deviation is the square root of the variance def Histogram () // Print a histogram of the data in scores // the bar chart in chapter 6.10 will give you a // good starting point.

13th Nov 2016, 4:53 PM
james ainsworth
james ainsworth - avatar
2 Answers
0
well, I don't know who got the idea of including the "count" parameter when you can take the length directly. But anyway : how do you compute the average of any numerical data ? Take the sum and divide it by the average. For median : assume the data is sorted : if the count is odd, it is the item at count//2, else it is half of the sum of scores[count//2] and scores[count//2 + 1]. Be sure it is sorted : sort it before (if needed). Variance : you have the formula, just implement it. Standard deviation : use math.sqrt(variance) or variance**.5 or pow(variance, .5). Histogram : should be the most difficult thing, in my opinion. Hope it helped.
13th Nov 2016, 8:19 PM
Amaras A
Amaras A - avatar
0
Amaras A, do you have any code in python on this problem?
13th Nov 2016, 9:11 PM
Jeff