title: Sorting data in a dictionary alphabetically in python
body: <p>I am learning how to use a dictionary to group the name and score together. It prints out from high to low score. I am trying to get it to only print out the highest score per person which I believe is using MAX but I can't do it. Any ideas?</p>
  
  <p>I also need to calculate the average score per student, so if they had 3 scores is that using <code>len</code>? </p>
  
  <pre><code>scores = {}
  resultfile = open("results.txt")
  for line in resultfile:
      (name, score) = line.split()
      scores[score]=name
  resultfile.close()
  
  print("The top scores were:")
  for each_score in sorted(scores.keys(), reverse = True):
       print(scores[each_score] + each_score)
  </code></pre>