If I have a Python dictionary, how do I get the key to the entry which contains the minimum value?
I was thinking about something to do with the min() function…
Given the input:
{320:1, 321:0, 322:3}
It would return 321.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Best:
min(d, key=d.get)— no reason to interpose a uselesslambdaindirection layer or extract items or keys!