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()