下为代码截图下为程序运行结果截图下为整个程序代码dict {} while True: print(请输入‘插入’‘删除’‘修改’‘查询’或者‘不录了’以选择你要执行的操作) a input() if a 插入: b input(输入学号) if b in dict: print(学号已存在) continue name input(输入姓名) gender input(输入性别) age input(输入年龄) major input(输入专业) dict[b] [name, gender, age, major] elif a 删除: b input(输入要删除的学号) if b in dict: del dict[b] else: print(没有该学生信息) elif a 修改: b input(输入要修改的学号) if b not in dict: print(没有该学生) continue new_name input(新姓名) new_gender input(新性别) new_age input(新年龄) new_major input(新专业) if new_name: dict[b][0] new_name if new_gender: dict[b][1] new_gender if new_age: dict[b][2] new_age if new_major: dict[b][3] new_major elif a 查询: b input(请输入要查询的学号) if b in dict: print(f学号{b}) print(f姓名{dict[b][0]}) print(f性别{dict[b][1]}) print(f年龄{dict[b][2]}) print(f专业{dict[b][3]}) else: print(没有该学生) elif a 不录了: print(拜拜) break总结该代码主要使用了while内嵌套if进行操作循环的功能使操作的人能对字典里的键值进行各项操作