8/13: Keeping Track of produce. Please Help


#1

Ok so not sure what is wrong with my code, please help. It keeps popping up with a message about Orange.

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]


#2

Your code looks fine is your indentation is right? can you format your code?
1) copy and paste your code
2) highligt/select your whole code
3) then look for this </> and press it.
or
simply press ctrl + shift + c and past the code inside the highlighted area.


#4


SO I took a screen shot to see if it will help better. So I think I indented correctly but not sure what the orange means


#5

This is really weird but found the error last second line it says "prices" change it into "price"


#6

Ok, that worked out! Thanks so much!


#7

Thanks very much from me too! I was kinda stuck with this!


#8

I wrote "Price"/"Stock" instead of "price"/"stock" and got weird orange message too:slightly_smiling:


#9

it should be like that

for item in prices:
    print item
    print "price: %s" % prices[item]
    print "stock: %s" % stock[item]

#10

A post was split to a new topic: Need help


#11

Thanks! I was pulling my hair out with this one. That's such a stupid error.


#12

Thanks! I was trying to do the print just for apple. Must have not understood correctly.


#15