I am writing a programme that is a quiz that, in a nutshell, asks the users questions and stores their name and score on a text file in this format:
Name: Humzah Score: 10
Name: Mohammed Score: 15
As you can see it stores their information successfully. However, I want it to be that if a user redid the quiz with the same name, it would check to see if the name is on the text file and will add the score to the line e.g
Name: Humzah Score:10 Score: 5
This is the code I have so far:
file=open("DataforScores.txt", "a")
def checkUserExists(user):
I have searched for similar questions ,however, the answers are too cryptic and it doesn't answer my second question. How do I then add to that line?