# 返回一个列表中第二大的数 def second(lt): max = 0 s = {} for i in range(len(lt)): flag = 0 for j in range(len(lt)): if lt[i] <= lt[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 return i print(second([1,5,7,4,5,6,8,5,9,9,10,11,5,20,19]))
版权声明:本文为chen1042246612原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。