Keeping Track of the Produce


#1

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

This is the message I keep getting -


#2

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


#3

From what I can tell they look exactly the same?


#4

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


#5

They are exactly the same


#6

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


#7

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


#8

Okay, I'll give it a go.

Yes, its an apple


#9

It's still not working


#10

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


#11

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]


#12

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)


#13

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

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


#14

There we go.

so the example is

apple
price: 2
stock: 0

and your print for that is:

apple
prices: 2
stock: 0

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

apple
apple

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.


#15

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


#16

It still doesn't work


#17

._.

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?


#18

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


#19

Well there you go then.

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


#20

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