code
#coding=utf-8 l=[1,2,3,4,5,6,7] max1=l[0] max2=l[1] if(max1>max2): pass else: max1,max2=max2,max1 for i in l[2:]: if(i>max2): max2=i if(max2>max1): max1,max2=max2,max1 print(max2)
输出
6
code
#coding=utf-8 l=[1,2,3,4,5,6,7] max1=l[0] max2=l[1] if(max1>max2): pass else: max1,max2=max2,max1 for i in l[2:]: if(i>max2): max2=i if(max2>max1): max1,max2=max2,max1 print(max2)
输出
6