A day at the supermarket - Check what your code prints for


#1



Replace this line with your code. 

> 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]

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

I get an error message: 
  
  
    Oops, try again.
    Check what your code prints for orange. It doesn't look quite right!


#2

I used as well print 'prices : ' + str(prices[key])

But i can not go forward.


#3

Get rid of the spaces after prices and stock. Also make it price not prices.


#4

Thank you for reply. I cleared the spaces, changed prices to price

price = {'banana' : 4, 'apple' : 2, 'orange' : 1.5, 'pear' : 3}
stock = {'banana' : 6, 'apple' : 0, 'orange' : 32, 'pear' : 15}
for key in price:
print key
print "price:%s" % price[key]
print "stock:%s" % stock[key]

I still however receive following:
Oops, try again.
Check what your code prints for orange. It doesn't look quite right!


#5

I used following and it works:

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]

Thank you


#6

hi , what did you change on your last code because i did the same thing and did not work.


#7

Hello, I have used this code:
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]
Note: Indentation should be applied in the star marked lines