Keeping Track of the Produce


#1



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


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


Can someone help? Can't figure out whats wrong


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 "Prices: %s" % prices[key]
    print "Stock: %s" % stock[key]


#2

for key in prices

One of the above words should be 'stock'


#3

... ???? The for loop is fine.


#4

The problem here is in your print statements. "Prices: %s" should be "price: %s", and "Stock: %s" should be "stock: %s".

Yeah, I know. The SCT for this exercise is very particular.


#5

I got the same problem.Please help me to move forward with this exercise.My code is absolutely correct but I still get an error message telling me to check what my code prints for orange.Please I beg you.


#6

In order to answer that question, I'm going to need to see your code.


#7

Thanks, I changed them to be lowercase but am still getting the same error:

orange
prices: 1.5
stock: 32
pear
prices: 3
stock: 15
banana
prices: 4
stock: 6
apple
prices: 2
stock: 0
None


#8

It should be price not prices


#9

Could you help me???
What is wrong???

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 "prices: %s" % prices[key]
    print "stock: %s" % stock[key]

But it is written : Oops, try again. Check what your code prints for orange. It doesn't look quite right!

But in the answer everything is correct. If smb need, I have print screen


#10

you should be printing "price: %s" not "prices: %s" in the 2nd to last line of your code


#11

I've found it myself, but thank you))


#12

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