数组输出最大值和最小值

98 阅读1分钟

scores = [40, 50, 43, 70, 10, 30, 64, 88, 55, 12] ScoreMax = scores[0] for index in scores: if index > ScoreMax: ScoreMax = index print(ScoreMax)

ScoreMin=scores[0] for index in scores: if index < ScoreMin: ScoreMin=index print(ScoreMin)