8/13. Not working for me

I’m having trouble with this and i need help!


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” % price[key]
print “stock: %s” % stock[key]

Same I keep getting Oops, try again. Check what your code prints for orange. It doesn’t look quite right! but everything prints correctly

1 Like

here should be price instead of prices

1 Like

@heyimisabela

You defined your dictionary with the name prices, but then you try to print it with the name price[key] (missing final s). You must use the same name in all occurrences.

@sequence32

You wrote prince instead of price. Correct it and it should work.
I got the same error just for writing Price (Title Case) instead of price (lowercase).

Dude the problem is just give a space after colon… in simple words, format it this way

print “price: %s” % prices[key]
print “stock: %s” % stock[key]

1 Like

it is so upsetting when the code is correct and you spend an hour trying to explore what you were doing wrong, but miss it by one letter

3 Likes

Thanks :smiley: worked, f**** spaces :expressionless:

2 posts were split to a new topic: Don’t know what is wrong

5 posts were split to a new topic: Please help me

I am having the same problem…exactly same !! Have you rectified it?

I had just came across this problem, my fix was that I had:

print “prices: %s”%prices[key]
print “stock: %s”%stock[key]

The fix?
Removed the ‘s’ from the console output.
print “price: %s”%prices[key]

1 Like

Hello you all !

This is what worked for me :

But I learned nothing there : I just had to copy it on you because the clues given on the left side : “str(4)” and “price+str(4)” gave nothing when used…It just made me lose one hour searching.

you are printing prince instead of price

My problem with this was parentheses in my print statement. In Python 3.0, you have to use print(), so that’s what I’ve been doing. This IDE didn’t like it today.