I have two lists:

`prices = [0, 5, 10, 15, 20, 25]`

```
items = [
    {
        “name” : “foo”,
        “price”: 12.3
    }
    {
        “name” : “foo1”,
        “price”: 12.7
    }
    {
        “name” : “foo2”,
        “price”: 20.4
    }
]

```

I am looking to order items based on the prices, so the result should be something like this:

```
result = {
    “<5”: [],
    “<10”: [],
    “<15”: [
        {
            “name” : “foo1”,
            “price”: 12.7
        }
        {
            “name” : “foo”,
            “price”: 12.3
        }
    ],
    “<20”: [],
    “<25”: [
        {
            “name” : “foo2”,
            “price”: 20.4
        }
    ],
    “>25”: []
}

```

So I have made a double loop which works, but I don't think it is super efficient and python way

```
result = []
for i in range(0, len(prices) - 1):
   itm_list = []
      for f in items:
         if f['price'] > prices[i] and f['price'] <= prices[i+1]:
            itm_list.append(f)
      result.append({f'<{prices[i+1]}': sorted(itm_list, key=lambda k: k['price'], reverse=True)})

```