A day at the supermarket lesson 8. (orange doesn't look quite right)



I have tried SO many different options to get the code to pass but, I keep getting the (orange doesn't look quite right) error message when i compile. Help would be greatly appreciated

I really strongly suspect that my code is right and that this error that i keep getting is on codecademy's compiler. I do have it printing what the instructions ask for; I just fail to see why orange would cause an error.

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

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

for key in prices:
    if key == 'apple':
        print key
        print 'Price: %s' % prices[key]
        print 'Stock: %s' % stock[key]


why do you have an if condition? You want to print this for all products, remove the if condition

price and stock should be lowercase (validation is case sensitive)


I put the if statement because I thought the instructions were just asking for apple price:2, stock: 0

I changed price and stock to lowercase and it worked!

I did that before and it didn't pass; any ideas why that would be?


from the instructions:

Like the example above, for each key, print out the key along with its price and stock information

apple was only to demonstrate how the output should look like, the instructions tell you need this output for all products

well, you see how strict the exercise validation is, so probably another obscure mistake


Thanks for the help mod!