float("-inf") evaluates to negative infinity, which is a value that is smaller than any finite number, and
float("inf") evaluates to infinity, which is a value that is larger than any finite number.
The hint asks you to do this:
largest_value = float("-inf")
largest_key = ""
That is so that regardless of how small any of the values are in
my_dictionary, we can ensure from the start that
largest_value does not exceed the largest value there. Subsequently, we can compare, iteratively, each value we encounter to whatever is, thus far, the largest value we have found.
The code recommended by the hint will produce correct output for the test function calls that are provided at the bottom of the script. However, we need to look more critically at it.
Consider this portion of the hint:
Any time you find a value larger than what is currently stored in
largest_value , replace
largest_value with that new value. Similarly, replace
largest_key with the key associated with the new largest value.
That recommendation suggests that we use this
if my_dictionary[key] > largest_value:
However, the above is inadequate for handling a particular special case that we could contrive. Can you figure out what that special case would be?