A Day at the Supermarket: Keeping Track of the Produce


#1



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

The error message I keep getting is
"Check what your code prints for orange. It doesn't look quite right!"


In my console, it prints this for orange:

orange
Price: 1.5
Stock: 32

The values 32 and 1.5 are correct, and I believe my print statements are in order. I don't know what's wrong.

prices = {
       "banana" : 4,
       "apple" : 2,
       "orange" : 1.5,
       "pear" : 15
}

stock = {
      "banana"  : 6,
      "apple" : 0,
      "orange" : 32,
      "pear" : 15
}

for item in prices
      print item
      print "Price: %s " % prices[item]
      print "Stock: %s " % stock[item]


#2

This exercise is very strict about formatting.

Your one of the o/p should look like this..

orange
price: 1.5
stock: 32

Can you find any difference(s) ?


#3

Yes, I did.
Thank you.


#4

So my code is working but it won't let me move on to the next lesson. Help

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]

#5

hint*
The "P" of Price and "S" of Stock should be lowercased ?
As I also said same thing in first post .

This exercise is very strict about formatted output.


#6

A post was split to a new topic: Keeping trace of product


#7

I did get it to work it turns out my words are capitalized. Thank you for
your help


#8

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