Here I want my code to let the user enter a game and then enter a rating, and the loop puts it in a dictionary but what I would like to do it sort the dictionary (games) by the ratings that the user input for the games
games = []
def gamef():
print("Here you will type your favorite games and then rate then out of 10 and this will sort them for you. ")
while True:
name = input("Enter your game for the games list: ")
rating = [int(i) for i in input("Enter your rating for the game: ")]
games.append({
"Game Title": name,
"Game Rating": rating
})
cont = input("Want to add another? (Y/N)")
if cont == "N":
break;
if cont == "n":
break;
gamef()
print("Here's your games list: ")
print(games)
games.sort() # <-- Need help here.
print("Here's your list of games in order by rating.")
print(games)
I would like this to sort the dictionary by the rating and then print it. Please help me make the code sort it. How should I sort a dictionary based off of its values, where many of the values will have repeated, non-unique entries?