find the max value in dictionary python
my_dict = {'a': 5, 'b': 10, 'c': 6, 'd': 12, 'e': 7}
max(my_dict, key=my_dict.get) # returns 'd'
find the max value in dictionary python
my_dict = {'a': 5, 'b': 10, 'c': 6, 'd': 12, 'e': 7}
max(my_dict, key=my_dict.get) # returns 'd'
Python find max in list of dict by value
lst = [{'price': 99, 'barcode': '2342355'}, {'price': 88, 'barcode': '2345566'}]
maxPricedItem = max(lst, key=lambda x:x['price'])
minPricedItem = min(lst, key=lambda x:x['price'])
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us