Question: HELP WRITE A FUNCTION IN PYTHON : SCORES1.TXT is this format for example: Function name: find_avg Parameters: file_name (str), student_name (str) Return value: student_avg (float)
HELP WRITE A FUNCTION IN PYTHON :

SCORES1.TXT is this format for example:

Function name: find_avg Parameters: file_name (str), student_name (str) Return value: student_avg (float) Description: Read in a file (that has the same format shown above). Find the student specified by the parameter. Generate the average of all the student's score and return the average. If the student has a DNT, disregard that score (do not use that to compute the average). Round the answer to 2 decimal places. Assume not two students have the same name and every student will have at least one valid test. If the name of the student passed in is not in the file, return 0. Assume the passed in filename is a valid file. Test Cases: >>> find avg("scores1.txt", "Iron Man") 95.44 >>> test1 find-avg("scores1.txt", "Iron Man") >>> print (test1) 95.44 >>> test2 = find-avg("scores2.txt", "Wonder Woman") >>> print(test2) 97.86 >>> test3 = find-avg("scores1.txt ", "Superman") print(test3) 0.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
