Recipe: How to find MIN, MAX in a Dictionary?
DATA MUNGING DATA CLEANING PYTHON

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')


Stuck at work?
Can't find the recipe you are looking for. Let us know and we will find an expert to create the recipe for you. Click here
Companies using this Recipe