python中的字典生成式

#需求1:假設有20個學生,學生的分數在60~100之間,篩選出成績在90分以上的學生 import random stuInfo = {} for i in range(20): name = 'westos' + str(i) score = random.randint(60, 100) stuInfo[name] = score print(stuInfo) highscore = {}
相關文章
相關標籤/搜索