I am creating a quiz in which each users score is saved to an external text file. However, whenever I output a report for the highest score in the maths easy quiz it says: ValueError: invalid literal for int() with base 10: ''
This seems to be the line with the problem:
if highestScore <= int(line.strip()):
with open("mathsEasy.txt") as mathsEasyFile:
highestScore = 0
for line in mathsEasyFile:
if highestScore <= int(line.strip()):
highestScore = int(line.strip())
mathsEasyFile.close()
print "The highest score is", highestScore
Basically, everytime a user does the maths easy quiz it saves their score to the text file called mathsEasy.txt
The text file looks like this: the username : score
for example Kat15 : 4
I need to output the highest score only, not the username as well.