Extreme Points

Report a typo

Write a program that identifies and prints the keys associated with the minimum and maximum values in a given dictionary.

Input:

  • You will be working with a pre-defined dictionary variable named test_dict.

Output:

  • Your program should print two lines:

    1. The key of the minimum value, preceded by "min: "

    2. The key of the maximum value, preceded by "max: "

For the dictionary test_dict = {"a": 43, "b": 1233, "c": 8}, your program should output:

min: c
max: b

The built-in min() and max() functions accept a key argument, which can be used to specify the comparison criteria. In this case, you can use it to compare dictionary values instead of keys.

Write a program in Python 3
# The following line creates a dictionary from the input. Do not modify it, please
test_dict = json.loads(input())

# Work with the 'test_dict'
___

Create a free account to access the full topic