title: Python Programming for the absolute beginner Chapter 7 Challenge 2
body: <p>I've been trying to learn python using this book, however, I seem to be stuck on this challenge.</p>
  
  <p>"2. Improve the Trivia Challenge game so that it maintains a high-scores list in a file. The program should record the player's name and score if the player makes the list. Store the high scores using a pickled object."</p>
  
  <p>I decided to use lists instead of dictionaries because I don't think I can sort the dictionary scores.  However, to update the dictionary version per your question, when you load the dictionary give it another variable and then add that variable to the original.</p>
  
  <p>so it would go something like this:</p>
  
  <p>first I created a blank list to hold the dictionary.</p>
  
  <pre><code>high_scores = []
  </code></pre>
  
  <p>then run a separate program to update the scores.</p>
  
  <pre><code>new_score = {score: player}
  
  f = open("high_Scores.txt", "rb")
  score_list = high_scores
  f.close()
  score_list.append(new_score)
  score_list = score_list[:10]
  f = open("high_scores.txt", "wb")
  pickle.dump(score_list, f)
  f.close()
  </code></pre>
  
  <p>this only holds 10 scores and will update the dictionary.  I haven't figured out how to sort 
  the scores and from reading I don't think it's possible to do at this point in the book.
  I was thinking of switching over to lists or something.  I haven't really worked on it so I'm not sure at this point.  if you figure it out let me know.  </p>