print('-' * 40)
print("欢迎使用学生通讯管理系统v1.0")
print("[1] 增加学员信息")
print("[2] 删除学员信息")
print("[3] 打印学员信息")
print("[4] 退出系统")
print('-' * 40)
students = []
while True:
n = int(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"],))
else:
print('欢迎使用学生通讯管理系统v1.0')
break
2021-10-29
最新推荐文章于 2024-06-07 13:01:43 发布