Keeping Track of the Produce


Help! I don't understand where I'm going wrong?!!

This is the message I keep getting -


There's an example of how it should look in the instructions, have you compared them? They should look exactly the same so keep in mind that just "looks about the same" is not a sufficient comparison


From what I can tell they look exactly the same?


Now you're doing the "looks about right" kind of comparison

You need to up your definition of exact

There are about 30 characters in the example, should take about as many seconds to compare


They are exactly the same


I've compared them millions of times and changes a million things after looking at other posts on it but no matter what I do, it says its wrong


Paste the example and the corresponding print from your code (I believe it's apple in the example?)


Okay, I'll give it a go.

Yes, its an apple


It's still not working


Not sure what you just did.

What I meant was that you could post both the example and what your code outputs, as a post here

And then I could get all obvious on you and point out the difference

The problem here is your method of comparison is off.

OR there's something else off about your observations, something isn't adding up and we gotta fix it


Mine -
for key in once:
print "apple"
print "prices: %s" % once["apple"]
print "stock: %s" % twice["apple"]

Example -
for key in once:
print "Once: %s" % once[key]
print "Twice: %s" % twice[key]


Yes, yes, but what's being printed out? And what's the example in the instructions where it shows how it should look? (not the code)


The instructions say the final output should be:
price: 2
stock: 0

but mine comes out as:
prices: 2
stock: 0
prices: 2
stock: 0


There we go.

so the example is

price: 2
stock: 0

and your print for that is:

prices: 2
stock: 0

Let's compare them line by line then, example first, then yours


price: 2
prices: 2

stock: 0
stock: 0

They're different!

And you actually have a second difference as well, what are you, as they mention, printing for oranges? I'm seeing a whole lot of apples.


Let me guess. We ran into discourse's post limit for new users. .. i fixed that


It still doesn't work



Okay but.. what does "not work" mean?

Do you agree that there was a difference? Did you eliminate that difference? What about the other difference?


I agree there was a difference but even after making the changes of orange and prices to price, it still didn't work.
It tells me to check my code

What it prints is correct, it just prints it too many times for some reason


Well there you go then.

What is the program meant to do, judging by the instructions? (And how is it meant to accomplish it)


The programme is meant to take the keys and print them with the numbers related to them. It does this, but three times for some reason, which I think is the problem