My code doesnt work


#1

Hello,
I got a problem with my code can someone please help me

Keeping Track of the Produce

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

prices = { 
    "banana":4,
    "apple": 2,
    "orange": 1.5,
    "pear": 3}
food = {
    "banana": "banana",
    "apple":"apple",
    "orange":"orange",
    "pear":"pear"}
stock = {
    "banana": 6,
    "apple": 0,
    "orange": 32,
    "pear": 15 }
for i in prices:
    print "%s" % food[i]
    print "Prices: %s" % prices[i]
    print "Stock: %s" % stock[i]

#2

Hi @gigajumper38418

A link to the proper lesson would help us assist you, so we can read the instructions.


#3

All you need to do is remove this line,

And this dictionary,


#4

this line:

print "%s" % food[i]

you could also just print i? since the keys of the prices dictionary are what you need

then this two lines:

print "Prices: %s" % prices[i]
print "Stock: %s" % stock[i]

it should be price and stock (all lowercase letters, and no s at the end

the printout should be an exact match


#5

thank you I just had to erase the s at the end of the word price
now my code does work thank you :kissing_heart:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.