fork download
  1. d = {'AAA': 1, 'BBB': 5, 'CCC': 3}
  2.  
  3. for k in sorted(d, key=d.get, reverse=True):
  4. print("{} - {}".format(k, d[k]))
Success #stdin #stdout 0.02s 9280KB
stdin
Standard input is empty
stdout
BBB - 5
CCC - 3
AAA - 1