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]
Your code looks fine is your indentation is right? can you format your code?
- copy and paste your code
- highligt/select your whole code
- then look for this </> and press it.
or
simply press ctrl + shift + c and past the code inside the highlighted area.
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
This is really weird but found the error last second line it says “prices” change it into “price”
3 Likes
Ok, that worked out! Thanks so much!
Thanks very much from me too! I was kinda stuck with this!
I wrote “Price”/“Stock” instead of “price”/“stock” and got weird orange message too:slightly_smiling:
it should be like that
for item in prices:
print item
print "price: %s" % prices[item]
print "stock: %s" % stock[item]
1 Like
mtf
Split this topic
10
A post was split to a new topic: Need help
Thanks! I was pulling my hair out with this one. That’s such a stupid error.
xhoosex
12
Thanks! I was trying to do the print just for apple. Must have not understood correctly.