import json import os grade_file = "final_grade.json" if os.path.exists(grade_file): with open(grade_file) as f: data = json.load(f) print(json.dumps({"grade": data.get("total", 0), "status": "graded"})) else: print(json.dumps({"grade": 0, "status": "error"}))