Netbeans | Python In
def get_average_grade(self): """Calculate average grade of all students""" if not self.students: return 0 total = sum(s.grade for s in self.students.values()) return total / len(self.students)
def to_dict(self): """Convert student object to dictionary for JSON serialization""" return 'student_id': self.student_id, 'name': self.name, 'age': self.age, 'grade': self.grade, 'created_at': self.created_at.isoformat() python in netbeans
def add_student(self, student): """Add a new student""" if student.student_id in self.students: print(f"Student with ID student.student_id already exists!") return False self.students[student.student_id] = student print(f"✓ Student student.name added successfully!") return True python in netbeans