I need to write a function that will multiply the quantity of each item with its price, combine the total of each, and then divide that sum by the total number of items.  

`[(3.99 * 1 + 1.99 * 3 + .99 * 3 + 2.99 * 1 + .75 * 9) / 17]`

```py
shopping_cart = {
    "tax": .08,
    "items": [
        {
            "title": "orange juice",
            "price": 3.99,
            "quantity": 1
        },
        {
            "title": "rice",
            "price": 1.99,
            "quantity": 3
        },
        {
            "title": "beans",
            "price": 0.99,
            "quantity": 3
        },
        {
            "title": "chili sauce",
            "price": 2.99,
            "quantity": 1
        },
        {
            "title": "chocolate",
            "price": 0.75,
            "quantity": 9
        }
    ]
}

```

I've written the code below but I'm encountering 2 issues. 1) When I test the portion that multiplies the item quantity with its price, I get 0's for each result. 2) Once that part is solved, I don't know how to hold off on dividing by the total quantity (17), until after all the complete running total is calculated.

```py
def get_average_spent_per_item(d):
    RunningCombinedItemTotal=0
    for i in d['items']:
        RunningCombinedItemTotal += ((i['price'] in d['items']) * (i['quantity'] in d['items']))
        return RunningCombined total / (len(d['items'])) 

```

**#this last line should only run after the full amount of `RunningCombinedItemTotal` is calculated**

I've read through tons of material but when it comes to working with nested dictionaries, all I can find is material on how to create them but not how to operate on them. If anyone knows of any material that covers this I'd like to review it.