What does points_per_position.get returns?

I was looking at the mission’s answer and I don’t get what this part of the code returns to the max function.


max(points_per_position, key = points_per_position.get)

.get() is a built-in method for Python dictionaries.

It returns the value for a dictionary key.

Note: key above refers to the key: value pairs for dictionaries, and not the key attribute in the max() function.

So, in the max() function, when we use key = points_per_position.get, we are basically asking the function to find the maximum value corresponding to the keys in points_per_position dictionary and then return the key corresponding to that maximum value.


Thank you! :slight_smile:

1 Like

Hello, I was wondering why the .get key = points_per_position.get takes no parameters? and if there is a difference between .get() and the .get in this particular code