Python 2 Supermarket help

I need help with one of the python assignments. This one in particular.

Here’s my code.
Screen Shot 2020-06-15 at 1.32.44 PM

Why isn’t my code printing the total? It just keeps printing zero.

The only statement that you have that assigns a value to total is:

total = 0

After the initial assignment, update the value of total within a for loop.


I don’t understand. Could you eleborate?

You have:

for food in prices:

The statement that follows, which would be inside the loop, should add to total the product of stock[food] and prices[food].


Print statements never do anything more than literally print text to console. You are looking for statements that actually affect variables and objects to be the core of your code.

For example
#in this scenario you can use y in your code
y = 4+5

#instead of here, where the statement is printed but not held by any variable

Print statements only help reflect the status of those variables to you and user.