Orange Error on A Day at the Supermarket


#1

I am on the exercise, A Day at the Supermarket, and I'm stuck on this error

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

This is my code

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

Can anyone show me what's wrong with my code?


Replace this line with your code.


#2

Take a look:

This should be your output (as Codecademy asks):

apple
price: 2
stock: 0

There's a typo, something isn't spelled right.


#3

My code is structured as requested.

orange
Price: 1.5
Stock: 32
pear
Price: 3
Stock: 15
banana
Price: 4
Stock: 6
apple
Price: 2
Stock: 0
None

#4

Yes, but the first letter is capitalized in Price and Stock. The instructions are strict on leaving them lowercased.


#5

Ohh..Thanks. I'd now mark this post as resolved.


#6

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]

Still i'm seeing above error "Oops, try again. Check what your code prints for orange. It doesn't look quite right!"
Can you please help me out?


#7

Did you read this?:

If anyone else needs more help, or if this doesn't resolve your problem, please create a new topic like it's stated in the Guidelines. Thank you :slight_smile:


#8

Okay Thank You!!

Thanks for your help. Working fine now for me.


#9

Having the same problem and it's not to do with the capital P and S in the text part of the print statement - I have used small p and s there and it is still giving the same error message.


#10

Please copy and paste your code here, to help us detect the cause of the error


#11

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