I’ve written a function to pull results from a text file which includes the name and score of a player. I want to be able to reorder the top 5 results and display them. The formatting of the results file is Name,Score. My code for this is below. However when I run it I get the error “ValueError: not enough values to unpack (expected 2, got 1)”. Could someone please help explain why I keep getting this error?
def top_scores(): file = open("Results.txt", "r+") read_file = csv.reader(file) scores =  for line in file: (name,score) = line.split(",") #The code fails at the line above scores.append((name,score)) scores.sort(key=lambda tup: tup, reverse=True) place = ["First", "Second", "Third", "Fourth", "Fifth"] for i in range(0,min(len(scores), 5)): print(place[i] + ":\n" + scores[i] + " - " + str(scores[i]))