# 返回一个列表中第二大的数 def second(ln): max = 0 s = {} for i in range(len(ln)): flag = 0 for j in range(len(ln)): if ln[i] >= ln[j] and i != j: flag = flag + 1 s[i] = flag if flag > max: max = flag print(s) for i in s: if s[i] == max - 1: break print(ln[i]) second([1,2,7,4,5,6,8,5,3,3,9,9,10,11,5,3,20,19])