From 3a1a6e0f92be244e759f466de58af09bcbc54842 Mon Sep 17 00:00:00 2001 From: pwihf5mjr <3200695141@qq.com> Date: Tue, 21 Nov 2023 12:55:46 +0800 Subject: [PATCH] ADD file via upload --- 111.txt | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 111.txt diff --git a/111.txt b/111.txt new file mode 100644 index 0000000..bcaa64d --- /dev/null +++ b/111.txt @@ -0,0 +1,56 @@ +stu_list=[] +def menu(): + print("1.添加学生") + print("2.删除学生") + print("3.修改学生信息") + print("4.查询学生信息") + print("5.显示学生信息") + print("6.保存学生信息") + print("7.退出系统") + +def add_student():#添加学生信息 + name = input('请输入学生姓名:') + # ----------- + for i in stu_list: + if i['name'] == name: + print('学生信息已存在') + return + gender= input("请输入学生性别:") + phone=input("请输入学生电话:")#加入信息 + stu_dict= { 'name': name, 'gender': gender,'phone':phone} + stu_list.append(stu_dict) + print() + +def remove_student():#删除学生信息 + name=input('请输入要删除学生姓名:') + for i in stu_list: + if i['name'] == name: + stu_list.remove(i) + print('学生信息删除成功') + return + else: + print('该学生信息不存在,无法删除') + +while True: + + num=eval(input("请输入序号:")) + if num==1: + add_student() + elif num==2: + remove_student() + # elif num==3: + # modify_student() + # elif num==4: + # search_student() + # elif num==5: + # show_student() + # elif num=6: + # save_student() + # elif num==7: + # print('退出系统,欢迎下次使用') + # save() + # break + else: + print("输入有误,请再次输入") + continue + input('======回车键继续操作======')