点数の低い順
ranking = {
'A':100,
'B':80,
'C':95
}
print(sorted(ranking, key=ranking.get))
実行結果
['B', 'C', 'A']
点数の高い順
ranking = {
'A':100,
'B':80,
'C':95
}
print(sorted(ranking, key=ranking.get, reverse=True))
実行結果
['A', 'C', 'B']