编写程序,将多名学生(学号 姓名)信息存入列表aList中(以空信息结束输入),提示用户输入学号,如果该学号在同学文件中,显示存在信息;否则显示否定信息。
4条回答 默认 最新
threenewbee 2023-03-31 10:12关注稍等,帮你写
aList = [] while True: info = input("输入学生信息(学号 姓名),输入空信息结束:") if info == "": break aList.append(info.split()) sid = input("学号:") for s in aList: if s[0] == sid: print("姓名为:", s[1]) break else: print("没有找到")解决 无用评论 打赏 举报 编辑记录