A simple Python command-line app to manage student marks, calculate averages, assign grades, and persist data to data.json.
- Add, update, delete students
- View a report of all students (marks, average, grade)
- Persistent storage in
data.json
app.py: CLI menu and program entryclasses.py:StudentandGradeManagerclassesjsonFile_handler.py: Save/load helpers fordata.jsondata.json: JSON data store for students
- Python 3.8+
- Clone or download the project.
- (Optional) Create a virtual environment.
- Ensure
data.jsonexists with valid JSON (a prefilled dataset is included).
python app.pyYou will see a menu with options:
- Display Report: prints each student's marks, average, and grade.
- Add new Student: prompts for name and three marks (Math, English, Science). An ID like
123-Ais auto-generated. - Update student Records: provides student ID, then enter
subject,scoreto add/update that subject. - Delete a student Record: removes a student by ID.
- Exit: saves current data back to
data.json.
Notes:
- Subjects are stored as a dictionary; new subjects can be added during update.
- Grades are computed from average: A (>=90), B (>=80), C (>=70), F (<70).
data.json is an object whose keys are numeric strings ("0", "1", ...). Each value is a student record:
{
"0": {
"id": "101-A",
"name": "Alice Johnson",
"subjects": {"Math": 95, "English": 88, "Science": 92},
"grade": "A",
"average": 91.67
}
}- If
data.jsonis empty/invalid, the app may fail to load. Ensure it contains valid JSON. - When adding via CLI, enter marks as comma-separated integers, e.g.:
90,80,85.
- Add more subjects or validation for scores.
- Improve CLI input handling and error messages.
- Build a GUI or web API on top of
GradeManager.
MIT