Get the key corresponding to the minimum value within a dictionary

Best: min(d, key=d.get) — no reason to interpose a useless lambda indirection layer or extract items or keys!

>>> d = {320: 1, 321: 0, 322: 3}
>>> min(d, key=d.get)
321

Leave a Comment