A day at the supermarket - orange error


#1

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

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

for price in prices:
print prices[price]

stock = {
"banana" : 6,
"apple" : 0,
"orange" : 32,
"pear" : 15,
}
for key in prices:
print 'price: %s' % prices[key]
print 'stock: %s' % stock[key]
'''
I keep getting the error message "Oops: try again. Check what your code prints for orange. It doesnt look quite right.


#2

The instructions include ...

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

Your code outputs the price and stock information. But does it first print out the key?


#3

Hello. I'll send you my code. I had the same problem.
for x in prices:
print x
print 'price: %s' % prices[x]
print 'stock: %s' % stock[x]


#4

I am also having the same problem.


#5

I was not printing the key and I had an additional print statement included. Thanks for the suggestion. I'm all good now. Thanks dimpata.


#6

Check out dimpata's suggestion.


#7

I was not printing out the key. Thanks.


#8