8. keeping trace of product


#1

Could anyone help with my code

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]

Oops, try again. Check what your code prints for orange. It doesn't look quite right!
It doesn't show it in the post but it is properly indented in the code, no errors.


8. Keeping Track of Produce
#2

Hey! You print prices instead of price. That's all.


#3

you do not print the "key" correctly.

try

print "%s" % key


#4

sometimes there are multiply ways to solve a problem, both ways are good to print key. The problem is what @dutchc0de says it is, the price instead of prices.


#5

you need to change "prices" to "price" than it will work


#6

your code can be completely correct but if "Price" or "Stock" is uppercase it also wont work. same with plurals, etc.


#7

Thanks everyone I did everything you guys said and it wouldn't work until I capitalized Orange lol go figure.