2 Réponses
0
l=[5,8,2,9,4,10,7]
print("3rd largest in",l,"is",sorted(l)[-3])
+ 9
#If you are not allowed to use sort, try this.
l=[5,8,2,9,4,10,7]
for j in range(3):
max=l[0]
for i in l:
if i>max: max=i
if j==2: print(max)
else: l.remove(max)