Write a program that reads the name of a data file which


Purpose of this assignment: The purpose of this assignment is to understand function and file.

Problem Statement: Write a program that reads the name of a data file which contains student ids (such as c1234500) and their scores. The program will find and print the average score, the number of students processed, the student ID with the highest score, and the processed output as shown in the sample output.

Sample Input files:

Sample output 1

Sample output 2

score3.txt

c1234500   91.5

Enter the file name: score3.txt

Enter the file name: score.txt

c1234501   83

 

score.txt does not exist.

c1234502   96

There are 8 record in the file

 

c1234503   63.5

The average of the scores is 85.5

Enter the file name: score.dat

c1234504   82

 

score.dat does not exist.

c1234506   78

Student ID score Grade standing

 

c1234507   95

c1234500    91.5    A   above

Enter the file name: score4.txt

c1234510   95

c1234501    83.0    B   below

 

 

c1234502    96.0    A   above

There are 3 student records.

score4.txt

c1234503    63.5    D   below

The average score is 90.2

C5432101  95

c1234504    82.0    B   below

 

c5432102   83.5

c1234506    78.0    C   below

Student ID score Grade standing

c5432103   92

c1234507    95.0    A   above

C5432101    95.0   A   above

 

c1234510    95.0    A   above

c5432102     83.5   B   below

 

 

c5432103     92.0   A   above

 

c1234502 have the highest score of 96

 

 

 

C5432101 have the highest score of 95

REQUIREMENTS:-

 

1) Print the purpose of the program.

2) Your program must read an input file name interactively.

3) If file does not exist. print error message and keep asking the user to enter another file name.

4) Your program should read and count student records from the file until the end of file.

5) Your program will find and print the average score, the number of students processed

6) Your program will find and print the student ID with the highest score

7) The processed output is displayed in the table format as shown in the sample output. The program output should show ID, score, standing. and the letter grade (A for >90, B for >80, C for >70, D for >60. otherwise F).

8) Program Structure: Your program must define and call the following functions. You may define other functions.

• find standing(scores, avg) # find and return the list that stores the standing of each student as either above or below.
• print tables(id list, scores list. stand list): given 3 lists print the table as shown above.
• letter_grade(score) # find and return the letter grade for the score
• open_file() # returns the successfully opened file object

10) Your program must have a beginning comment block and proper documentation as in ola 1.

Solution Preview :

Prepared by a verified Expert
Python Programming: Write a program that reads the name of a data file which
Reference No:- TGS01382527

Now Priced at $55 (50% Discount)

Recommended (95%)

Rated (4.7/5)