Python 3.11
I was coding a leaderboard and I haven't found a way, how to sort the users, my dictionary is this:
users = {
"level": {
"Mark": 4,
"Steve": 3,
"Justin": 4,
"Markus": 2
}, "xp": {
"Mark": 43,
"Steve": 25,
"Justin": 48,
"Markus": 32
}
}
Is there a way to sort the users first by the level, and then if some users have the same level (in that case Mark and Justin), then sort them again by their xp? So it would be like this:
leaderboard = [
"Justin",
"Mark",
"Steve",
"Markus"
]
Thanks!