From 13bd0c3bebff8b63e942dc73057e9cc0e6ed703f Mon Sep 17 00:00:00 2001 From: pn3wc6zte <2134311920@qq.com> Date: Tue, 21 Nov 2023 19:10:53 +0800 Subject: [PATCH] ADD file via upload --- studenInfos.py | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 studenInfos.py diff --git a/studenInfos.py b/studenInfos.py new file mode 100644 index 0000000..1b751fb --- /dev/null +++ b/studenInfos.py @@ -0,0 +1,77 @@ +def menu(): + print("1、添加学员") + print("2、删除学员") + print("3、修改学员信息") + print("4、查询学员信息") + print("5、所有学员信息") + print("6、退出系统") + h = input("请输入你要选择的功能:") + if(h.isdigit() == False): + print("输入有误!请重新输入!") + menu() + h = int(h) + if (h==1): + addStudent(); + elif (h==2): + delSutdent(); + elif (h==3): + updateStudent(); + elif (h==4): + selectStudent(); + elif (h==5): + allStudent(); + elif (h==6): + return ; + else: + print("输入有误!请重新输入!") + menu() + menu() + +list = {} + + +def addStudent(): + name =input("请输入姓名:") + sex = input("请输入性别") + tel = input("请输入电话") + list[name] = [name,sex,tel] + print("添加成功!") + +def delSutdent(): + name = input("请输入要删除的姓名:") + h = list.get(name,0) + if h !=0: + del list[name] + print("删除成功!") + else: + print("不存在,{}".format(name)) + + +def updateStudent(): + name = input("请输入要更新的姓名:") + h = list.get(name, 0) + if h != 0: + del list[name] + name1 = input("请输入姓名:") + sex = input("请输入性别") + tel = input("请输入电话") + list[name1] = [name1,sex,tel] + print("更新完成!") + else: + print("不存在,{}".format(name)) + +def selectStudent(): + name = input("请输入要查询的姓名:") + h = list.get(name, 0) + if (h!=0): + print("姓名:{},性别:{},电话:{}".format(h[0], h[1], h[2])) + print("查询完成!") + else: + print("不存在,{}".format(name)) + +def allStudent(): + for i in list.values(): + print("姓名:{},性别:{},电话:{}".format(i[0],i[1],i[2])) + print("查询完成!") + +menu() \ No newline at end of file