Keeping track of produce


#1

Hi - sorry, but I'm getting the same error message and I don't have the plural. I've been thinking it doesn't like the price of orange being "1.5". If it's not that, and it's not this, I'm confused.

Thanks very much for revisiting this!


Keeping track of produce
#2

after price and stock you seem to have two spaces, rather then one


#3

Erg. THANK you! That's exactly what I had.


#4

I did the same thing you did but it still said the orange is wrong


#5

Now I got it I had the price and stock capitilized


#6

how did you get the price of oranges = 1.5

i am unable to get it look:

price = {"banana":4,
"apple":2,
"orange":1.50,
"pear":3}
stock = {"banana":6,
"apple":0,
"orange":32,
"pear":15}
for x in prices:
print x
print "price: %d" %price[x]
print "stock: %d" %stock[x]


#7

Ye had the same problem, kinda stupid the exercise fail cause of the capital letter in a string. Doesn't make sense its an error


#8

the problem will be %d, should be %s
good luck.


#9

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

Above is my code, i am getting output but with following error

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

Could some one please help me on this.


#10

I got the answer, thanks guys..


#11

prices = {"banana":4,"apple":2,"orange":1.50,"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]

I get this, please help
Oops, try again. Check what your code prints for orange. It doesn't look quite right!


#12

I get the same "Oops, try again. Check what your code prints for orange. It doesn't look quite right!" error though my output seems correct?

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]

Output

orange
Price: 1.5
Stock: 32
pear
Price: 3
Stock: 15
banana
Price: 4
Stock: 6
apple
Price: 2
Stock: 0
None

#13

same :frowning:
i tried do tones of thinks it reflect same problem


#14

need your help


#15

what is it any help will be great


#16

@mk485eg and @drewdiver,

You guys really should read what other people said their problem was.

@dekistena perfectly stated the problem.

Hope you figure it out. :slight_smile:


#17

Hi,

If you have an error or need help create a +New topic with code, error and lesson


#18