什么语言?以下是python参考#coding:utf-8import randomdef MaxMin(a): r=[] max=a[0] min=a[0] for i in a: if max<i: max=i if min>i: min=i r.append(max) r.append(min) return ra=[]for i in range(0,20): a.append(random.randint(1,100))print(a) r=MaxMin(a)print("max=%d min=%d"%(r[0],r[1]))结果