if __name__ == '__main__':
records = []
smallest = 0
fat = int(input())
for x in range(fat):
name = input()
score = float(input())
records.append([name, score])
records.sort(key=lambda x:x[1])
print(records)
for i in range(len(records)-3):
if records[i][1] <= records[i+1][1]:
del records[i]
else:
''
print(records)
When I input this:
6
Jorge
3
Mia
3
Gus
5
Myles
4
Gerald
9
Fred
8
The output is [['Mia', 3.0], ['Gus', 5.0], ['Gerald', 9.0]]. I want to remove all the parts of the list with the lowest value. Why isn't this code working?