Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PYCHARM ( please comment code and explain what is it doing ) In this program you

ID: 3869020 • Letter: P

Question

PYCHARM ( please comment code and explain what is it doing) In this program you will be writing data to and reading data from a file.  A good way to start to this program is to begin by getting the output written to the screen. That is if a student record is supposed to look like "Dave, 35, 25, 99" then begin by seeing if you can get that output written to the monitor. All parts must be in the same python file. Use a main() function and other functions that you create as needed.

Part A:

Input names and three test scores of students from the user, terminated by "ZZZ" and create a data file "grades.txt" with records of the following form:

student_name (String), test_1 (Integer), test_2 (Integer), test_3 (Integer)

Note: the terminating student name (ZZZ) should not appear in the data file

Part B:

Read and Display the contents of the file "grades" created in Part a. Each student’s record should appear on a separate line and include the total score (the sum of the three tests) for that student.

See the sample python interaction to see how the data should look at output.

Create functions that will work with the following main(). That is, your main() should contain the following code:

Part C: put a time-stamp at the end of the output

Sample Python interaction (Bold Italics is input)

Sample Text File containing the output from the program:

Explanation / Answer

# function to execute the application def main(): # set the working file name fn = "grades.txt" # set the number of scores scores = 3 # get student names and scores, persisting them into a file getStudentData(fn, scores) # obtain the student data from the file lines = getTextFileContents(fn) # print the file contents in report format printReport(lines)