Day at the Supermarket


#1

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

print total

can someone help me with this
it is showing total is not correct


#2

look at this code:

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

print total
print prices

it is yours, with one added print statement.

it will print the prices dictionary, as you can see you changed the prices, this is what gives the error


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.