# Python – Get key with maximum value in Dictionary

## Python | Get key with maximum value in Dictionary

Given a dictionary, the task is to find the key having the maximum value.
Examples :

```Input : {'Audi':100, 'BMW':1292, 'Jaguar': 210000, 'Hyundai' : 88}
Output : Jaguar

Input:  {'Geeks':1900, 'for':1292, 'geek' : 88}
Output:  Geeks```

Method #5: Using max() function

 `# Python code to find key with Maximum value in Dictionary` ` ` `# Dictionary Initialization` `Tv ``=` `{``'BreakingBad'``:``100``, ``'GameOfThrones'``:``1292``, ``'TMKUC'` `: ``88``}` `Keymax ``=` `max``(``zip``(Tv.values(), Tv.keys()))[``1``]` `print``(Keymax)`

Output:

`GameOfThrones`

Method 2: Using max() with lambda function

 `# Python code to find key with Maximum value in Dictionary` ` ` `# Dictionary Initialization` `Tv ``=` `{``'BreakingBad'``:``100``, ``'GameOfThrones'``:``1292``, ``'TMKUC'` `: ``88``}` `Keymax ``=` `max``(Tv, key``=` `lambda` `x: Tv[x])` `print``(Keymax)`

Output:

`GameOfThrones`

Method 3: Using operator

 `# Python code to find key with` `# Maximum value in Dictionary` `import` `operator` `# Dictionary Initialization` `Car ``=` `{``'Audi'``:``100``, ``'BMW'``:``1292``, ``'Jaguar'``: ``210000``, ``'Hyundai'` `: ``88``}` `# Getting max item` `keyMax ``=` `max``(Car.items(), key ``=` `operator.itemgetter(``1``))[``0``]` `print``(keyMax)`

Output:

`Jaguar`

Method 4:

 `# Python code to find key with Maximum value in Dictionary` `# Dictionary Initialization` `Company ``=` `{``'GFG'``:``10000``, ``'Hashd'``:``2292``, ``'Infy'``: ``200``}` `# taking list of car values in v` `v ``=` `list``(Company.values())` `# taking list of car keys in v` `k ``=` `list``(Company.keys())` `print``(k[v.index(``max``(v))])`

Output:

`GFG`

Last Updated on October 29, 2021 by admin

## int() function in Pythonint() function in Python

int() function in Python Python int() function returns an integer from a given object or converts

## Python – Convert dictionary object into stringPython – Convert dictionary object into string

Python | Convert dictionary object into string Dictionary is an important container and used almost

## Python – os.path.splitext() methodPython – os.path.splitext() method

Python | os.path.splitext() method OS module in Python provides functions for interacting with the operating system.

## Saving a Pandas Dataframe as a CSVSaving a Pandas Dataframe as a CSV

Pandas is an open source library which is built on top of NumPy library. It

## Python – Check if a Substring is Present in a Given StringPython – Check if a Substring is Present in a Given String

Python | Check if a Substring is Present in a Given String Given two strings,

## Get a list as input from user – PythonGet a list as input from user – Python

Python – Get a list as input from user We often encounter a situation when

## Ways to remove i’th character from string in PythonWays to remove i’th character from string in Python

Ways to remove i’th character from string in Python In Python it is all known

## How to split a string in C/C++, Python and Java?How to split a string in C/C++, Python and Java?

How to split a string in C/C++, Python and Java? Splitting a string by some