Python dictionaries are not "orderly". There are several other objects that can be sorted in python, so I suggest you use one of them and then transfer them to an Ordereddict dictionary (which, unlike a common dictionary, keeps the order in which it was created whenever you access it), for example:
from collections import OrderedDict
# Criando pontuações em lista de tuplas (poderia ser lista de listas)
data = [('Asma', 6), ('Cachumba', 5), ('Difteria', 4),('Rubeola', 9)]
# Criando o dicionario
od = OrderedDict([par for index, par in sorted((tpl[1], tpl) for tpl in data)])
print (od)
OrderedDict([('Difteria', 4), ('Cachumba', 5), ('Asma', 6), ('Rubeola', 9)])
print(od['Cachumba'])
5
Edited
If you want it in reverse order:
# Criando pontuações em lista de tuplas (poderia ser lista de listas)
data = [('Asma', 6), ('Cachumba', 5), ('Difteria', 4),('Rubeola', 9)]
# Criando a indexação na ordem reversa
dr = sorted([(tpl[1], tpl) for tpl in data], reverse=True)
# Criando o dicionário
od = OrderedDict([tpl[1] for tpl in dr])
print (od)
OrderedDict([('Rubeola', 9), ('Asma', 6), ('Cachumba', 5), ('Difteria', 4)])
Obs.:
If your list is already sorted, then just create the dictionary (Ordereddict) normally. As for the question of the "command" at the end of the question, I could not understand, the purpose of dictionaries is only to map keys/values.
Related: https://answall.com/q/233096/5878
– Woss