I created a dictionary using a for-loop and this code:
players[name] = {'roll_total': player_roll, 'ante': None}
Previously my dictionary was just players = {names: totals} and I could sort it using this code:
players = [(k, players[k]) for k in sorted(players, key=players.get, reverse=True)]
But now since I implemented the inner "attribute" dictionary, I get an error saying comparisons can't be made on dictionaries.
TypeError: '<' not supported between instances of 'dict' and 'dict'
So how can I modify the sorting method to compare values of the dictionaries (the roll_total values), and have my players dictionary sorted?
key=lambda x: players[x]['roll_total']