8/13. Not working for me


#1

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]


#3

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


#4

here should be price instead of price**s**


#5

@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).


#7

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]


#8

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


#9

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


#10

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


#12

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


#13


#14

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


#15

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]


#16

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.


#17

you are printing prince instead of price


#18

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.