Python 列表操作:添加学生姓名和分数,并根据姓名查询分数
lst=[] for i in range(5): name=input() score=int(input()) lst.append((name,score)) name_query=input() for item in lst: if name_query==item[0]: print(item[1]) break else: print('error')
原文地址: https://www.cveoy.top/t/topic/osmG 著作权归作者所有。请勿转载和采集!