Keeping Track of the Produce


#1


Keeping Track of the Produce

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

It to work. I don't have the capitalisation issue, I don't think.


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]


#2

from instruction : print the answer in the following format:
apple

price: 2
stock: 0

so remove letter s from prices


#3

Thanks. That works.

A very awkward little 'catch you out' that one.


#4

you welcome ; this not the first time i see this error also i did the same error !


#5

The same thing happened to my code. I didn't understand that instruction
apple

price: 2
stock: 0

what does this change and why(or which s) are we removing? Thanks in advance!

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

Oops, try again. You should have exactly three print statements! (Make sure there are no occurrences of 'print' in any comment or string!)


#6

you have to follow the instrcution

so for your code remove s from prices , and also print the element ( key apple bannana ....)


#7

Thanks azazaz! this still gives error.

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]

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


#8

Hi this line

print "key"

just remove the " " around key


#9

it worked. thank you


#10

i am too have such kind of problem
i think there is no any capitalization


#11

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]


#12

HI this line

print "prices: %s" % prices[key]

you should remove the s to prices it should be

print "price: %s....

only to the first price in this line..