I can't keep track of my produce in order


I am stuck on lesson 8 Keeping track of the produce.
You can see my code down below but this is my error message:
Oops, try again. Check what your code prints for orange. It doesn't look quite right!
In the box where it shows my output looks alright but the order is wrong. The Orange comes first then pear the banana then apple.
I do have the price and stock sorted but I am guessing the problem is the order:
banana should come first then apple then orange then pear.
So I'm not sure.

That is my code:

prices = {
stock = {
for key in prices:
    print key
    print "prices: %s" % prices[key]
    print "stock: %s" % stock[key]


Dictionaries are unordered, there is no order to adhere to.

What you are printing doesn't match the format described in the instructions, compare them.


I also for got to add this. This is my output box. Everything is shown except for one line under everything that says none


Ok thanks for your help.


I did compare them and I did exactly what it said I have triple-checked it. Save the words I needed to switch out.


It didn't work. I still need help.


There's an example in the instructions. Compare it character by character with what you print.
It should not be possible to tell any difference, it should be an exact match.

price: 2
stock: 0

That's 24 characters, including line terminations, sufficiently short to just eyeball it.

There are also tools where you can copy each one and compare them, I'm sure there are a few online variations if you search for "online diff tool"


It's one character in your print statement at the bottom. Match the output EXACTLY as the instructions request.


hi, i know what's the problem, it's should
print "price: %s" % prices[key]


Thank you so much.
I was also stuck at this lesson.
Your comment helped:slight_smile: