from heapq import nlargest
with open("winnernum.txt", "r") as f:
numbers = [float(line.rstrip()) for line in f.readlines()]
largest = nlargest(5, numbers)
print(largest)
I have tested this code and it works if there is no string next to each number because you can't turn a string into a float i assume. The string is there because each highscore has a username next to it. the program should print the winner's name and their score for the top 5 highest scoring players.