8. Keeping track of the produce: Orange error


#1



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


I'm following all the instructions but it tells me "Oops, try again. Check what your code prints for orange. It doesn't look quite right!" I checked the console and instead of printing this:
orange
price: 1.5
stock 32
It prints this instead:
orange
price: 1
stock: 32
My code is below. If anyone can help, that would be great!:worried::slight_smile:


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: %d" % prices[key]
    print "stock: %d" % stock[key]


#2

Use %s instead of %d.


#3

:grin: Thank you so much @zh30!


#4

A post was split to a new topic: Check what your code prints for orange. It doesn't look quite right!


#5

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