Keeping track of the produce


#1



8 Keeping Track of the Produce


it keeps saying "Check what your code prints for pear. It doesn't look quite right."


I expect it to work since I am doing exactly what the program says.


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


#2

Change this string to just "orange"


#3

ok. I did that and now it says "Check what your code prints for orange. It doesn't look quite right!"


#4

please give a link to your exercise :slight_smile:


#5

https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/1/3?curriculum_id=4f89dab3d788890003000096


#6

The strings here should be just "price: %s" and "stock: %s"


#7

ok. I tried that and I am still getting the same error for pears.


#8

Show me your updated code


#9

I tried this with and without the second %

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


#10

You haven't changed this string to,"price: %s"

and oranges to orange here,


#12

oh man! That was it? I thought it definitely had to be prices since prices is the name of the dictionary.


#13

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