max()

If you pass a dictionary to the max() function, then it returns the key with the maximum worth. The syntax of the method is as follows:

max(dict)

See the following example:

>>> dict1 = {1:"abc",5:"hj", 43:"Dhoni", ("a","b"):"game", "hj":56}
>>> max(dict1)
('a', 'b')

So, the max function gives the tuple the maximum worth. Similarly, to get the minimum key, you can use the min() function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.179.59