Page 181 -
P. 181
still looking for a winner
Who won the surfing contest?
In the previous chapter, you worked out the top three scores,
but they’re not much use without the names of the surfers that
achieved those scores. There will no be surfing for you until
you’ve finished the program.
Here’s the code so far:
scores = []
result_f = open("results.txt")
for line in result_f:
(name, score) = line.split()
scores.append(float(score))
result_f.close()
scores.sort()
scores.reverse()
print("The top scores were:")
print(scores[0])
print(scores[1])
print(scores[2])
You still don't
know who won.
Winners
1 st
2 nd
3 rd
146 Chapter 5