Oranges Suck


#1

I have been trying to get this to work on "A Day at the Supermarket", but it keeps on throwing up an error message saying the output for oranges is incorrect. I looked on here on a couple of other posts and tried those "fixes" and nothing is working. What should i do?
https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/1/3?curriculum_id=4f89dab3d788890003000096

prices = { 
    "banana" : 4, 
    "apple" : 2, 
    "orange" : 1.5, 
    "pear" : 3 
}

stock = { 
    "banana" : 6,
    "apple" : 0,
    "orange" : 32,
    "pear" : 15
}

for key in prices and stock:
    print key
    print "price: %s" % prices[key]
    print "in stock: %s" % stock[key]

#2

Hi this line

print "in stock: %s" % stock[key]

just remove in before stock because the lesson want you to print it like that

apple
price: 2
stock: 0

without in


#3

I dont know where that in came from. It wasnt in my original code.... weird. Thank you


#4

Hello, my code is as described above and I continue to get the orange error. When I cross check values and letter cases, I tried matching with the sample screen and it still does not work. My code is the following:
h
prices = {
"banana":4,
"apple": 2,
"orange": 1.5,
"pear": 3
}

stock = {
"banana":6,
"apple":0,
"orange":32,
"pear":15
}

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


#5

Hi, @clarenceble ,

What does this line print? ...

print "prices: %s" %prices[item]

Compare it carefully to what is specified in the instructions.


#6

Hello, I keep getting the error message about the orange stuff. I checked my code with the ones presented above and I still failed to have the codes working. What should I do?

prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}

stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}

for key in prices and stock:
print key
print "prices: %s" % prices[key]
print "stock: %s" % stock[key]


#7

prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}

stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}

for key in prices and stock:
print key
print "price: %s" % prices[key] #it have to be "price: %s" %prices[key]
print "stock: %s" % stock[key]


#8

Oops, I just noticed that it asked to use the term "price" instead of "prices".


#9

yep, try to check the output format,
I had the problem before, but now I fix it