A day at the supermarket


#1

What do you have to put in instaead of the question marks. Please help.
for key in prices:
print ???
print "Price: %s" % prices[key]
print "Stock: %s" % stock[key]


#2

you should put the variable which contains the products of your prices dictionary


#4

that is a string, not a variable

The loop iterator (key) contains all your products

also, price: and stock: should be all lowercase, the output needs to be an exact match to the example (this include case sensitivity)

if you need more help, post an updated version of your code


#5

I think my code is correct but the error is in orange : "Oops, try again. Check what your code prints for orange. It doesn't look quite right!"

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]


#6

a product price: not prices:


#7

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