I am stuck at lesson keeping track of the produce


#1



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] 


This is my code and when I run it I get error: "Check what your code prints for orange. It doesn't look quite right!"
and the values set are correct and output seems correct too so I dont know what is wrong.


#2

Here:

for key in prices:
    print key
    print "Price: %s" % prices[key] # Should be print "price: %s" % prices[key]
    print "Stock: %s" % stock[key] # Should be print "stock: %s" % stock[key]

The SCT on this exercise is really picky and wants the words price and stock to be printed without capitalization.


#3

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

This is my code, however i still get the same error message.


#4

It's "price: %s" not "prices: %s".


#5

Change 1.5 to: 5. That have helped me


#6

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