title: how do you add points on your python code
body: <p>i need help with a code that can calculate the points for every guess the user try. if the user get the answer right from the first try it will be 3 points, if its from the second guess then its 1 point. when the user win or lose it stores his username and score in a external file. when all users had a go then it displays the top 5 winners from the external file.</p>
  
  <p>i have already done the part that asks the user for the username and password and stores it in an external device. i have also wrote down a code to display the artists name and the first letter of the song and give the user 2 tries.</p>
  
  <pre><code>username= input("Please enter your username")
  password= input("Please enter your password")
  
  f=open("usernamepassword.txt","a")
  f.write(username)
  f.write(" ")
  f.write(password)
  f.write("\n")
  f.close()
  
  import random 
  
  for x in range(0, 1):
      randNum = int(random.randint(0, 1))
  
      song = open("Songs.txt", "r")
      songname = str(song.readlines()[0])
      print(songname[0])
      song.close()
  
      artist = open("Artists.txt", "r")
      artistname = artist.readlines()[0]
      print(artistname)
      artist.close()
      y = 0
  
      songGuess = input("What is the song called?")
      while(y&lt;=2):
          if songGuess == songname:
              print("Answer correct!")
              break
          else:
              y = y + 1
              songguess = input("Incorrect! try again")
  
          if y == 1:# 
              print("GAME OVER")
              break
  </code></pre>