def highscore(s):
with open('highscore.pkl', 'r+b') as f:
score = pickle.load(f)
for i in range(len(score)):
if s > score[i-1]:
score[len(score)-1] = s
break
score.sort()
score.reverse()
with open('highscore.pkl', 'w+b') as f:
pickle.dump(score, f, pickle.HIGHEST_PROTOCOL)