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'])
This tells you not just what the max price is but also which item is most expensive.
More Related Contents:
- How do you find min and max without using min and max function [duplicate]
- Getting the index of the returned max or min item using max()/min() on a list
- Find min, max, and average of a list
- I don’t know how to display step 3 for this assignment
- How to make a dict from n’th indices of tuples in list
- Access a particular field in arbitrarily nested JSON data [duplicate]
- Remove duplicate dict in list in Python
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- How to find all positions of the maximum value in a list?
- list to dictionary conversion with multiple values per key?
- How can I convert a dictionary into a list of tuples?
- Appending a dictionary to a list – I see a pointer like behavior
- merging Python dictionaries
- How can I initialize a dictionary of distinct empty lists in Python?
- List of tuples to dictionary [duplicate]
- [] and {} vs list() and dict(), which is better?
- Converting Dictionary to List? [duplicate]
- Converting a list of tuples into a dict
- Make dictionary from list with python [duplicate]
- Get a list of values from a list of dictionaries?
- Remove dictionary from list
- How do I sort this list in Python, if my date is in a String?
- How do I extract all the values of a specific key from a list of dictionaries?
- What are dict_keys, dict_items and dict_values?
- How do I send list of dictionary as Body parameter in FastAPI?
- Python The appended element in the list changes as its original variable changes
- Mapping dictionary value to list
- How to find the maximum number in a list using a loop?
- How to extract all values from a dictionary in Python?
- Comparing 2 lists consisting of dictionaries with unique keys in python