print("-" * 40)
print("欢迎使用学生通讯管理系统v1.0")
print("[1] 增加学员信息")
print("[2] 删除学员信息")
print("[3] 打印学员信息")
print("[4] 退出系统")
print("-" * 40)
students = []
while True:
n = print(input("请重新输入要操作的编号[1 ~ 4]:"))
if n == 1:
code = input("请输入学员学号:")
name = input("请输入学员姓名:")
tel = input("请输入学员电话:")
s = {"code": code,"name" :name,"tel": tel}
students.append(s)
print(students)
elif n == 2:
code = input("请输入待删除的学号:")
# 遍历列表,查找待删除的学员
for s in students:
if s["code"] == code:
students.remove(s)
print("删除成功")
break
else:
print("没有该学号的学生,删除失败!")
elif n == 3:
for x in students:
print("学号:%s\t姓名:%s\t电话:%s\n" % (x["code"], x["name"], x["tel"]))
elif n == 4:
print('欢迎使用学生通讯管理系统v1.0')
学生通讯管理系统
最新推荐文章于 2023-04-21 18:51:46 发布