Q:

Get the key of a minimum value from the following dictionary using python programming

belongs to collection: Python Dictionary Exercises

0

Get the key of a minimum value from the following dictionary

sample_dict = {
  'Physics': 82,
  'Math': 65,
  'history': 75
}

Expected output:

Math

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Hint:

Use the built-in function min()

Solution:

sample_dict = {
    'Physics': 82,
    'Math': 65,
    'history': 75
}
print(min(sample_dict, key=sample_dict.get))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a Python program to change Brad’s salary t... >>
<< Write a python program to rename a key city to a l...