Adding integers and strings into a text file
In my game quiz, I need to store the user and their scores in a text file. But, the problem is:
- I tried storing the data but I don't know how to output because an error comes up saying there are not enough data in the text file
- the program does not update previous scores if the same user plays
I need help with storing scores and user and printing the top 5.
Use a database, it’s more secure and easier to use. To use the database you first have to import it by doing:
from replit import db
Then you can use the db just like a dictionary except the name of the dictionary is db