Could someone explain this to me ?

`total = 0 for key in prices: total = prices[key] * stock[key] + total print total`

The above code is correct , but i am wondering why there is need to add `total`

to `prices[key] * stock[key]`

it should function well without total too ? But without total the answer is zero.

Any help is appreciated