It looks like code did not print correct total


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/1/4?curriculum_id=4f89dab3d788890003000096#

it looks like your code did not print the correct total

my total is actually correct


prices = {
    "banana" : 4,
    "apple"  : 2,
    "orange" : 1.5,
    "pear"   : 3,
}
stock = {
    "banana" : 6,
    "apple"  : 0,
    "orange" : 32,
    "pear"   : 15,
}

for key in prices:
    print key
    print "price: %s" % prices[key]
    print "stock: %s" % stock[key]
total=0
for key in prices:
    prices[key]=prices[key]*stock[key]
    print prices[key]
    total=total+prices[key]
print total

#2

yes, but you overwrote the price of products. In other words, bananas now cost 24, apples are free, oranges are expensive, 48$ and pears cost $45

don’t update the prices of the products


#3

thank you…now i got the right output :slight_smile:


#4