Write a Python program that reads from a text file whose name is provided by the user (see a sample below) students' three exam scores for the current semester. The first line contains the weight of the three scores. Each subsequent line contains the student id, followed by scores obtained in the midterm, labtest and final exam respectively. Your program should then display for each student, their id number, average score followed by the corresponding grade (A if average>=90, B if 90>average>=80, C if 80>average>=70 and F if average<70). Your program should consider the following erroneous cases and display appropriate message as shown in the sample output below:
The file does not open/exist
The weight in the first line are incorrect (non-numerical values, not equal to three, their, some not equal to 1) in which case a RuntimeError should be raised and don't process the subsequent lines.
The readings are invalid (non-numerical valuesor outside the range [0,100]) or the number of recorded scores is different than 3 in which case a ValueError exception should be raised and the processing should continue.
Attachments:
Answers
Answered by
1
to change direction or turn about or aside; shift, turn, or change from one course, position, inclination, etc., to another: The speaker kept veeringfrom his main topic. The car veeredoff the road. (of the wind)
WHT IS QUES FIRST?
Similar questions
Math,
2 months ago
English,
2 months ago
Business Studies,
2 months ago
English,
4 months ago
Social Sciences,
4 months ago
Math,
10 months ago
Math,
10 months ago