Question: Please write code in Newest version of Python (Data file not needed) A program that computes the following based on each data file: The median

Please write code in Newest version of Python

(Data file not needed)

A program that computes the following based on each data file:

The median value (Sort the grades in ascending order. If the # of students is odd you can take the middle of all the grades (i.e. [0, 50, 100] - the median is 50). If the # of students is even you can compute the mean by averaging the middle two values (i.e. [0, 50, 60, 100] - the median is 55)

The mode value (the grade that occurs most frequently - i.e. [0, 50, 50, 100] - the mode is 50). Hint: you will probably want to create two new lists to do this. One new list canhold the UNIQUE test scores found and the other can hold the # of times that score has been seen. For example:

unique = [100,90,80] seen = [1,5,3] 

Hint: use the "in" operator, the "append" method and the max function to help you solve this problem! If you need help look back at the "World Series Winner" program we wrote in class.Note that it is possible that multiple scores could qualify as the "mode". For example, say that you found a class to have the following scores:

unique = [50, 70, 70, 80, 80, 100] 

Both 70 and 80 are represented twice in the list, so they are both considered the "mode" for this class. For extra credit identify all "mode" values for a given file.

Here is a sample running of your program for the first two data files. A complete listing of the expected output for all data files can be found in the downloadable package for this assignment.

Enter a class to grade (i.e. class1 for class1.txt): class1 Successfully opened class1.txt **** ANALYZING **** No errors found! **** REPORT **** Total valid lines of data: 20 Total invalid lines of data: 0 Mean (average) score: 75.60 Highest score: 91 Lowest score: 59 Range of scores: 32 Median score: 73.0 Mode score(s): 73  
Enter a class to grade (i.e. class1 for class1.txt): class2 Successfully opened class2.txt **** ANALYZING **** Invalid line of data: does not contain exactly 26 values: N00000023,,A,D,D,C,B,D,A,C,C,,C,,B,A,C,B,D,A,C,A,A Invalid line of data: N# is invalid N0000002,B,A,D,D,C,B,D,A,C,D,D,D,A,,A,C,D,,A,C,A,A,B,D,D Invalid line of data: N# is invalid NA0000027,B,A,D,D,,B,,A,C,B,D,B,A,,A,C,B,D,A,,A,A,B,D,D Invalid line of data: does not contain exactly 26 values: N00000035,B,A,D,D,B,B,,A,C,,D,B,A,B,A,A,B,D,A,C,A,C,B,D,D,A,A **** REPORT **** Total valid lines of data: 21 Total invalid lines of data: 4 Mean (average) score: 78.00 Highest score: 100 Lowest score: 66 Range of scores: 34 Median score: 76 Mode score(s): 73  

Sample of Data file class1.txt:

N00000001,A,A,D,D,C,D,D,A,,C,D,B,C,,B,C,B,D,A,C,,A,,C,D N00000002,,A,,D,,B,D,A,C,C,D,,A,A,A,C,B,D,C,C,A,A,B,,D N00000003,B,A,,D,C,B,D,A,C,C,,B,A,B,A,C,B,D,A,,A,,B,D,D N00000004,B,B,D,,,B,D,A,C,C,D,B,A,B,A,C,B,D,,C,A,D,B,C,D N00000005,B,A,,D,,B,D,A,C,C,D,B,A,B,A,C,B,D,D,C,A,A,,D,D N00000006,B,A,D,A,C,B,D,A,C,C,C,B,A,D,A,C,,C,A,C,A,C,B,D,A N00000007,B,A,D,D,C,B,D,A,C,,D,B,A,B,A,C,B,D,,C,A,A,B,D, N00000008,A,A,D,D,C,,D,A,C,C,B,C,A,B,A,A,B,D,A,C,A,,B,B,D N00000009,B,A,,D,C,B,D,A,C,A,D,B,A,B,A,A,B,D,A,C,A,A,B,D,D N00000010,,A,D,B,C,B,D,A,C,C,D,B,A,B,A,C,B,D,A,D,,,B,D,B N00000011,B,A,D,,C,B,D,A,C,D,D,B,A,B,A,C,B,D,A,C,A,B,B,D,D N00000012,B,,D,D,C,B,D,A,C,C,D,B,A,B,A,A,B,D,A,,A,A,A,,C N00000013,,A,D,,B,B,,A,C,A,D,B,A,B,D,C,B,D,A,C,A,A,B,D,D N00000014,B,B,D,D,C,B,,D,C,C,D,B,A,B,A,C,,D,A,C,A,A,,D,D N00000015,A,C,C,D,C,B,,A,C,C,D,B,A,B,A,C,B,D,A,C,A,B,,D,D N00000016,B,A,C,D,,B,D,A,C,C,D,B,A,B,A,C,B,D,A,C,A,A,B,D,D N00000017,B,A,D,D,C,B,C,A,D,C,D,A,A,D,A,C,B,D,D,B,,A,B,D,D N00000018,B,A,D,A,C,B,D,A,C,C,D,B,A,B,,,B,D,A,B,A,A,B,,D N00000019,B,A,D,D,C,B,D,C,C,C,,B,,B,D,C,B,D,A,,A,A,B,D,D N00000020,B,,D,D,C,B,D,A,C,B,,,A,C,A,D,B,D,B,C,A,A,B,D,D

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!