// 示例代码:使用Python实现简单的学生信息管理系统
class Student:
def __init__(self, id, name, grade):
self.id = id
self.name = name
self.grade = grade
class StudentSystem:
def __init__(self):
self.students = []
def add_student(self, student):
self.students.append(student)
def find_student(self, id):
for student in self.students:
if student.id == id:
return student
return None
# 创建学生对象
alice = Student(1, "Alice", "A")
bob = Student(2, "Bob", "B")
# 初始化学生管理系统
system = StudentSystem()
system.add_student(alice)
system.add_student(bob)
# 查找学生
found_student = system.find_student(1)
print(f"Found: {found_student.name}, Grade: {found_student.grade}")
]]>