Question: Python 3.5 Please find my Student.py file here: https://pastebin.com/03Xq329B Please find my Main.py file here: https://pastebin.com/ycZH2Snr classlist.txt may be found here: https://pastebin.com/aHJ7yHma exam.txt may be
Python 3.5
Please find my Student.py file here: https://pastebin.com/03Xq329B
Please find my Main.py file here: https://pastebin.com/ycZH2Snr
classlist.txt may be found here: https://pastebin.com/aHJ7yHma
exam.txt may be found here: https://pastebin.com/ZjKPsyv7
exam2.txt may be found here: https://pastebin.com/QkDgAK2g
solution.txt may be found here: https://pastebin.com/wHTfWYzV
Note: All changes must be made to Main.py only.
If the third option of the menu, i.e., Start marking, is selected, the program should allow the user to type in a file name for reading a series of student responses. You should only proceed to the marking task if the program has read both the solution and the class list.
Here's a sample running of this section without both the solution and the class list: --------------------------------------------------- Enter your choice: 3 --------------------------------------------------- Not Enough Information! -------------------------------------------------- ... 6. Quit the program --------------------------------------------------- Enter your choice:
Here's a sample running of this section without the class list: --------------------------------------------------- Enter your choice: 1 --------------------------------------------------- Enter name of the solution file: solution.txt ... --------------------------------------------------- Enter your choice: 3 --------------------------------------------------- Not Enough Information! --------------------------------------------------- ... 6. Quit the program --------------------------------------------------- Enter your choice:
Here's a sample running of this section without the solution: --------------------------------------------------- Enter your choice: 2 --------------------------------------------------- Enter name of the classlist file: classlist.txt ... --------------------------------------------------- Enter your choice: 3 --------------------------------------------------- Not Enough Information! --------------------------------------------------- ... 6. Quit the program --------------------------------------------------- Enter your choice:
Here's a sample running of this section: --------------------------------------------------- Enter your choice: 1 --------------------------------------------------- Enter name of the solution file: solution.txt ... --------------------------------------------------- Enter your choice: 2 --------------------------------------------------- Enter name of the classlist file: classlist.txt ... --------------------------------------------------- Enter your choice: 3 --------------------------------------------------- Enter name of the data file: exam.txt Completed reading of file exam.txt Sum of marks: 23 --------------------------------------------------- ... 6. Quit the program --------------------------------------------------- Enter your choice:
Complete the read_data() function which returns a dictionary. The key of the dictionary item is the ID of a student and the value is a list of student responses from the corresponding student.
You may use the String data type's split() method to split apart the data from the file. You may need to use this method a few times along with a loop or two. For example, your file is organized so that one student's record occupies an entire line in the file. Splitting first on the line break will isolate each student's data. Then you will need to further split each item based on the separator character : to pull out the id and all responses. Next, you will need to split all responses into a list. For example: a student record is given as below:
N00000001:D,D,A,A,C,D,B,B,C,B,D,A,C,C,A
The function should convert the above record into a dictionary item in the following format:
Key: N00000001 Value: ['D', 'D', 'A', 'A', 'C', 'D', 'B', 'B', 'C', 'B', 'D', 'A', 'C', 'C', 'A']
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
