Keeping Track of the Produce | A day at the Supermarket


Hi guys, i'm having a bit of a problem in this exercise, my code:-

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

Now it gives me an error which says "Check what your code prints for orange. It doesn't look quite right". But i've checked it and it seems totally fine to me. It prints out this :-

Price: 1.5
Stock: 32
Price: 3
Stock: 15
Price: 4
Stock: 6
Price: 2
Stock: 0

Another thing which I want to know is that why is the loop starting from the third variable "orange" and not the first variable "banana"?



Lessons are case sensitive, type EXACTLY what you are told to type
That being said, do not type "Price" and "Stock" but "price" and "stock".

For the 2nd part of your question, I guess it is because dictionaries are unordered, as the lesson has said many times before


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