Python- Write a program that reads from files a sequence of scores and lets the user process the scores.
There are 5 input files called scores1.txt to scores5.txt. Each file contains a list of scores for one exam, and each score is
on one line of the file. All the files have the same number of scores.
The program has a main function that calls 4 other functions.
1. Call createTable() to:
Read in the data from each of the input files (in order from scores1.txt to scores5.txt) and store the data in
table. The table is a list of lists, where the scores of each input file is a
column
of data of the table.
By the end of the function, the table should have 5 columns of numbers, each column is from one input file.
Here is the first 4 rows of the table:
[83, 93, 85, 89, 97]
[95, 88, 85, 93, 95]
[88, 95, 84, 90, 96]
[72, 93, 70, 77, 97] …
If any file can’t be successfully opened, print an error message and end the program
2. Call removeLowest() to:
Remove the lowest score of each row of the table
By the end of the function, the table should have 4 column of numbers because the lowest value has been
removed from the table
Here is the first 4 rows of the table:
[93, 85, 89, 97]
[95, 85, 93, 95]
[88, 95, 90, 96]
[72, 93, 77, 97] …
3. Call saveTable() to:
Save the table to an output file or to a default lab5output.txt file. Choose the default file if the user hits
Enter instead of typing in a filename.
When saving the seating chart, each row of the table should be a row of the file, and the scores on one row
are separated by a space
4. Call graph() to:
Loop to prompt the user for an exam number (which is a column number) to graph, or let the user enter 0 to
end the loop
Graph the scores in a pseudo bar graph:
– all sorted scores that are 90 or above on the first line
– all scores between 80 and 89 are on the second line
– all scores between 70 and 79 are on the third line
– all scores between 60 and 69 are on the fourth line
– the rest of the scores are on the fifth line
See the sample output
The function should print an error message for a user input that’s not an integer and for a user input that’s
not within range of 1-4.
Additional Considerations
Try to use exception handling instead of if statement when checking for error
Try to use list comprehension when possible and if the resulting code doesn’t end up too difficult to read
Sample Output, user input is in blue:
Enter output filename: <Enter key>
Enter exam number (1-4) or enter 0 to quit: 1
97 97 96 96 95 95 95 95 95 93 93 92 91 91 91 91 90 90
89 88 87 87 86 85 85 85 84 84 83 83 83 81
79 75 72
50
Enter exam number (1-4) or enter 0 to quit: 2
97 97 96 96 95 94 93 93 91 91 91 91 91 90
89 89 89 89 88 88 88 88 88 87 86 85 85 85 84 83 82 81
76 76 74 72
Enter exam number (1-4) or enter 0 to quit: 3
99 99 98 98 98 98 98 97 97 96 96 93 91 90 90 90
89 88 88 87 87 86 85 85 84 83 82 80
77 75 73 72 70 70
68
50
Enter exam number (1-4) or enter 0 to quit: 4
101 100 100
99 99 99 98 98 98 97 97 97 97 96 96 95 95 94 94 93 93 92 92 91 90 90 90 90
89 88 87 84 83 81
72
64
Enter exam number (1-4) or enter 0 to quit: ab
Must be an integer
Enter exam number (1-4) or enter 0 to quit: -3
Must be 1-4
Enter exam number (1-4) or enter 0 to quit: 39
Must be 1-4
Enter exam number (1-4) or enter 0 to quit: 0
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


