Hi.. I've been trying to get this to work for hours now but I'm not understanding what to do.
Basically I'm creating a quiz on python with 5 questions.
I have a function that is only for the quiz.
Another function is to display the highest quiz score.
I want to keep the highest score in a text file that the program can read from and write to.
Here's the pseudo code for what I want to do:
- take quiz
- calculate score
- read highScore.txt
-- determine if new high score is greater than the high score in the text file.
----if yes: replace high score in text file with the next high score just received.
----if not: leave the text file as is
So far, I'm getting the program to just read what the text file says.
How do I assign a variable to the high score in the text file?
(Text File): oldScore
if newScore > oldScore, then write newScore to file
if newScore < oldScore, do nothing.
I'm not sure if I'm making sense, but I'm a newbie and just confused at this point.
Any help would be greatly appreciated!