L=[1,3,8,9,13,12,9,7,6,4]foriinrange(len(L)):ifL[i+1]print(L[i])break
直接用内置函数
L = [1, 3, 8, 9, 13, 12, 9, 7, 6, 4] print(L.sort()) print(max(L))