Error in python-a day at the supermarket


#1

prices = {
    "banana": 4,
    "apple": 2,
    "orange": 1.5,
    "pear": 3
    }
stock = {
    "banana": 6,
    "apple": 0,
    "orange": 32,
    "pear": 15
    }
for i in prices:
       print i
       print "prices %s" % (prices[i])
       print "stock %s" % (stock[i])

error - Oops, try again. Check what your code prints for orange. It doesn't look quite right!


#2

#3

A post was merged into an existing topic: Keeping trace of product


#4

Hello, my fruits are in a different name because i'm Brazilian, but try this code:
it worked for me.

GL!

prices = {
    'banana': 4,
    'maca': 2,
    'laranja': 1.5,
    'pera': 3
}

stock = {
    'banana': 6,
    'maca': 0,
    'laranja': 32,
    'pera': 15
}

for item in prices:
    print (item)
    print ("price: %s" % prices[item])
    print ("stock: %s" % stock[item])
    print

#5

the problem was solved in this topic


#6