May 2017
Intermediate to advanced
280 pages
6h 2m
English
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.
Read now
Unlock full access