Question
Code in python: student list is a text file that contains the StudentID and Student Name (one per line) 1237, Davis, Michael 1244, White, Ronald
Code in python:
student list is a text file that contains the StudentID and Student Name (one per line)
1237, Davis, Michael 1244, White, Ronald 2365, Smith, Jason 3458, Wilson, Robert 4445, Jones, Mary
The gradebook is also a text file contains the StudentID, Assignment Number and Score.
1237,1,87 1237,2,75 1237,3,94 1237,4,88 1237,5,89 1244,1,74 1244,2,65 1244,3,100 1244,4,80 1244,5,75 2365,1,80 2365,2,78 2365,3,90 2365,4,84 2365,5,84 3458,1,91 3458,2,70 3458,3,82 3458,4,66 3458,5,84
Write the code to calculate each persons current grade average.
Keep in mind that:
Every student in the student folder may not have the same number of scores in the gradebook.
Some students may not have any scores in the book.
After calculating the average, assign them a grade based on the scale:
90% -100% - A
80% -89% - B
70% -79% - C
60% -69% - D
0% -59% - F
Write their First Name, Last Name, calculated average and Grade to a file called sgrades.txt
Michael Davis - 86.6 - B
Ronald White - 78.8 - B
Jason Smith - 83.2 - B
Robert Wilson - 78.6 - B
Mary Jones - 0 - F
Note: There will not be any scores in the gradebook that do not have a matching student in the student folder.
Loop though the Student file, get their IDLoop through the Grade file.
If their ID matchesAdd their score to the total scoreIncrement the assignment count by 1After you have all their scores, calculate their total averageAssign a grade based on that averageWrite their name, average and grade to the output file.
NOTE: You are using 2 files. Once you loop through the file, you have to close it an reopen it to loop through again. Another method is to use the seek commandFilename.seek(0)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started