I think everything is printing out right but it tells me otherwise


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

I expected it to run fine which in my eyes it did

stock = { "bananas" : 6, "apples" : 0,  "pears" : 15,"oranges" : 32  }
for fruit in prices:
    print fruit
    print "price : %s" % prices[fruit]
    print "stock : %s" % stock[fruit]

and this is what it prints:
price : 3
stock : 15
price : 4
stock : 6
price : 1.5
stock : 32
price : 2
stock : 0

But still I'm left with the error that something about the way its printed looks funny. Can anyone help me?


you have a space between price and the colon, you need it to look like price: (no space)
same for stock's print line.
hope this helps! :slight_smile:


Thank you! this fixed it :slight_smile:


glad to help!


Im in the same situation. Any help would be much appreciated.

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

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

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

prices: 1.5
stock: 32
prices: 3
stock: 15
prices: 4
stock: 6
prices: 2
stock: 0


Sorry to bother. Its because I used prices which is the same as my dictionary and I guess i needed to use price. price it is.


I figured it out on my own, but I want to understand WHY it is requiring the ":" without the space...
Is it WRONG syntax or just for this AUTOMATED checker of the app?

I initially used print "In Stock: %s" and it failed too...



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