How to find MIN, MAX in a Dictionary?
0

How to find MIN, MAX in a Dictionary?

This recipe helps you find MIN, MAX in a Dictionary
In [1]:
## How to find MIN, MAX in a Dictionary
def Kickstarter_Example_57():
    print()
    print(format('How to find MIN, MAX in a Dictionary','*^82'))
    import warnings
    warnings.filterwarnings("ignore")

    # Create A Dictionary
    ages = {'John': 21, 'Mike': 52, 'Sarah': 12, 'Bob': 43}

    # Find The Maximum Value Of The Values
    print()
    print('Maximum Value: '); print(max(zip(ages.values(), ages.keys())))

    print()
    print('Maximum Value: '); print(min(zip(ages.values(), ages.keys())))

Kickstarter_Example_57()
***********************How to find MIN, MAX in a Dictionary***********************

Maximum Value:
(52, 'Mike')

Maximum Value:
(12, 'Sarah')