I want to make a leaderboard for my game that displays people with the highest number of coins.
Yes, it is possible.
scores = [] leaderboard = {} for key in db.keys(): scores.append(db[key]) highscore = max(scores) for key in db.keys(): if db[key] == highscore: leaderboard[key] = db[key] scores.pop(leaderboard[key]) highscore = max(scores)
Assuming that the key is the username, and db[key] is their highscore, then this would sort it in order.
key
username
db[key]
Now you can mark it as answered, thank you!
Is there a way to get the highest value stored in the repl database?
I want to make a leaderboard for my game that displays people with the highest number of coins.
Yes, it is possible.
Assuming that the
key
is theusername
, anddb[key]
is their highscore, then this would sort it in order.Now you can mark it as answered, thank you!