Question
In Python use a loop to read data from a text file which containing students' names and exam scores. The program should calculate the exam
In Python use a loop to read data from a text file which containing students' names and exam scores. The program should calculate the exam average for each student, determine the appropriate letter grade for that exam average, and count the total number of A's, B's, C's, D's, and F's for the whole class. The text file can be accessed using this link: scores.txt .
You need to print each strudent's name and their letter grade based on the averages of their 3 exam scores.
After printing all of the names and grades, you need to print a summary stating the number of As, Bs, Cs, Ds, and Fs for the whole class.
To get the letter grades you'll need to calculate the average of the 3 exam for each student and determine the appropriate letter grade for that average based on the criteria listed above. The code that determines the letter grade needs to be in it's own function.
The loop that reads the file should be able to work properly even if the number of students in the file is unknown or varies from day to day. That is, don't use 30 as a magic number. The program should work no matter how many records the file might contain.
Your program must have at least 2 functions A main() function, and a function to determine the letter grade. You could easily have more than 2 functions
Step by Step Solution
3.28 Rating (163 Votes )
There are 3 Steps involved in it
Step: 1
def main test1 intinputEnter test grade 1 test2 intinpu...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