Answer :
Design and develop a program in Python that validates and reads student information from a text file, stores it in a dictionary, and calculates the average grades for each student. The program should ask the user for an input file name, validate the file name, and display the student names, their grades, and the grade average to the console.
To implement the program, we can follow these steps:
1. Prompt the user to enter an input file name and validate if it exists. If the user enters an invalid file name three times, display an error message and quit the program.
2. Read the student information from the input file. Each student's name is followed by their grades, which are stored in a list. Create a dictionary where the student names are the keys and the grades are stored as values associated with each key.
3. Iterate over the dictionary and display the name of each student, followed by their grades and the average grade. Calculate the average grade by summing up the grades and dividing by the number of grades.
4. Display the student information to the console in the specified format, with each student's grades displayed on a separate line.
By following these steps, the program will effectively read and validate the student information from the input file, store it in a dictionary, and display the student names, grades, and average grades to the console.
Learn more about Python
brainly.com/question/30391554
#SPJ11