it call the simple_dict.get() method on each key of the sample_dict
i.e. sample_dict.get(Physics),simple_dict.get(Math),simple_dict.get(history) will be called
a list of values of the sample_dict will be return
and then use the values for comparison
at last, the min() function will return corresponding key for the lowest value.
key point
do not add () parentheses after the key=sample_dict.get
as the min() function will execute the method for you, you just need to pass it the method name, not to execute it.
My reflection
From this exercise, i learn there is more about the min() function, and understand why sometimes () parentheses is not added after method name or function name.
Top comments (0)