title: How to sort a .txt file numerically
body: <p>I am having trouble sorting my .txt file by a numerical value. I have attached the code and am trying to get it to sort by score,
  I also cant get it to print each new score to a new line from the txt file.</p>
  
  <pre><code>def Highscore():
      name = input("What is your name for the scoreboard?")
      newhighscore =(name, highscore)
      newline = ("\n")
      HighscoreWrite = open ("highscore.txt", "a")
      HighscoreWrite.write(highscore )
      HighscoreWrite.write(name )
      HighscoreWrite.write("\n")
      HighscoreWrite.close()
      HighscoreRead = open("highscore.txt", "r" )
      ordered = sorted(HighscoreRead)
  
  
      print (ordered)    
  
  
  
      print (HighscoreRead.read())
      #print (newhighscore)
      HighscoreRead.close()
  retry = "Yes"
  while retry == "Yes":
      print ("Welcome to this quiz.\n")
      score = 0
      attempt = 0
      while score &lt; 10:
          correct = Question()
          if correct:
              score += 1
              attempt += 1
              print ("Well done, You got it right")
          else:
              print ("Good try but maybe next time")
              attempt += 1
      highscore = score, ("/") ,attempt
      highscore = str(highscore)
      message = print ("You scored", (score), "out of ",(attempt))
      Highscore();
      retry = input("Would you like to try again? Yes/No")
  </code></pre>