学工管理系统
# 学生类定义
class Student:
def __init__(self, id, name, grade):
self.id = id
self.name = name
self.grade = grade
# 学工系统类定义
class SchoolSystem:
def __init__(self):
self.students = []

def add_student(self, student):
self.students.append(student)
def get_students(self):
return self.students
# 示例使用
system = SchoolSystem()
alice = Student(1, "Alice", 90)
bob = Student(2, "Bob", 85)
system.add_student(alice)
system.add_student(bob)
print([s.name for s in system.get_students()])
]]>