stu_list = []
while True:
print("1、录入学员信息")
print("2、删除学员信息")
print("3、查询学员信息")
print("4、搜索学员信息")
select = input("请输入你的选择")
if select == "1":
id = input("请输入学员的学号")
name = input("请输入学员的姓名")
age = input("请输入学员的年龄")
gender = input("请输入学员的性别")
score = input("请输入学员的成绩")
stu = {"id":id,"name":name,"age":age,"gender":gender,"score":score}
stu_list.append(stu)
input("输入回车返回菜单")
elif select == "2":
del_id = input("请输入要删除学生的学号")
for stu in stu_list:
if del_id == stu.get("id"):
stu_list.remove(stu)
break
else:
print("该学号不存在")
elif select == "3":
s = "学号\t姓名\t年龄\t性别\t得分 \n"
for stu in stu_list:
s += f"{stu['id']}\t{stu['name']}\t{stu['age']}\t{stu['gender']}\t{stu['score']}\n"
print(s)
input("输入回车返回菜单:")
elif select == "4":
data = input("请输入要搜索学生的信息")
seach = []
for stu in stu_list:
if data in stu.values():
seach.append(stu)
print(stu)
else:
print("没有学生符合该信息")
input("输入回车返回菜单:")