I've made a leader board for a larger quiz that I've been working on. I've wrote code that opens the text file and does "\n"
to print the things in that text file on different lines when ran. However, when run, it doesn't just display the name and their score like it should, it also displays the newline \n
that should be hidden. How do I fix this?
This code is where I'm having issues:
if score == 3:
print("You have reached the maximum amount of points and have reached the top of the current leaderboard, congrats.")
leaderboard = open ("leaderboard.txt","r")
write_in_file(leaderboard, score, username)
topscores = leaderboard.readlines()
print(topscores)
any help would greatly be appreciated as this assessment has a time limit that is quickly approaching.