title: Python maths quiz importing data from a txt file and organising it
body: <p>I'm currently doing the OCR computer science A453 CA, To summarize I was given 3 tasks, i have completed the first 2 but the last task is really giving me problems. My starting position is that i am meant to save scores from a maths test into a txt. file. The child's name, and score is saved in a file related to its class. For task 3 I am now asked to import this data to find the average scores and highest scores ordered highest to lowest and the scores arranged alphabetically. I have tried and tried but I cannot find a solution to this task. I have deleted all my experimental code to try to get it to work and have just left you with the code up until the scores are saved. Would be a great help to find a solution or even some good pointers on what to do! thanks :)</p>
  
  <p>CODE:</p>
  
  <pre><code>username=input("What is your name?") #childs name variable
  group=int(input("What class number are you, 1, 2 or 3?")) #this determines which file the score will be saved in
  print ("Welcome {} to the Arithmetic quiz".format(username))#The introduction to the quiz
  
  correctAnswers=0
  for question_number in range(10):
      if test():
          correctAnswers +=1
  
  print("{}: You got {} answers correct".format(username, correctAnswers))
  
  
  if group==1:#If the childs class 1,their score will be saved in the file for the class:1
      with open("class1.txt","a+") as f:
          f.write("{}:{}".format(username,correctAnswers))
  if group==2:#If the childs class is equal to 2, the file will be saved in the file for class:2
      with open("class2.txt","a+") as f:
          f.write("{}:{}".format(username,correctAnswers))
  if group==3:#If the childs class is equal to 3, the file will be saved in the file for class:3
      with open("class3.txt","a+") as f:
          f.write("{}:{}".format(username,correctAnswers))         
  </code></pre>