class Student:
def __init__(self, name, age, address):
self.name = name
self.age = age
self.address = address
# 创建一个空列表来存储学生对象
students_list = []
# 使用 for 循环录入学生信息
for i in range(2): # 你可以根据需要调整录入的学生数量
print(f"请输入第{i+1}个学生的信息:")
name = input("姓名: ")
age = int(input("年龄: "))
address = input("地址: ")
# 创建学生对象并添加到列表中
student = Student(name, age, address)
students_list.append(student)
# 打印录入的学生信息
print("\n已录入的学生信息:")
for student in students_list:
print(f"姓名: {student.name}, 年龄: {student.age}, 地址: {student.address}")