Understand logic but need help with format


A day at the supermarket

It looks like your code did not print the correct total.

I understand the logic. Multiply the individual items in stock by the listed price but I'm having trouble formatting it correctly. Am I still using a dictionary? If not, why not?

I wish Codecademy had a training wheels option for those of us who need a sample format with every exercise.

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]
def value(stock):
    total = 0
    if stock>0:
        stock = total * prices
    print total


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