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("请输入电话") student = [name,sex,tel] list.append(student) print("添加成功!") def delSutdent(): name = input("请输入要删除的姓名:") for i in list: if i[0] == name: list.remove(i) print("删除成功!") return else: print("不存在,{}".format(name)) def updateStudent(): name = input("请输入要更新的姓名:") for i in list: if i[0] == name: i[0] = input("请输入姓名:") i[1] = input("请输入性别") i[2] = input("请输入电话") print("更新完成!") return else: print("不存在,{}".format(name)) def selectStudent(): name = input("请输入要查询的姓名:") for i in list: if i[0] == name: print("姓名:{},性别:{},电话:{}".format(i[0],i[1],i[2])) break else: print("不存在,{}".format(name)) print("查询完成!") def allStudent(): for i in list: print("姓名:{},性别:{},电话:{}".format(i[0],i[1],i[2])) print("查询完成!") menu()