A day at the supermarket


#1




error message(s):

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
}
goods = {
    "banana",
    "apple",
    "orange",
    "pear"
    }
for key in prices:
    print goods
    print "Price: %s" % prices[key]
    print "Stock: %s" % stock[key]


ik goods probably doesn't need to be there i was just trying to fix it myself


#2

It's just a small mistake I think:

' print "Price: %s" ' should be : 'print "price: %s" ' :wink:


#4

First of all Delete goods List. Then in, for loop, print key like this:

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

This will work. Good Luck


#5

I tried it, and he's right, changing "Prices: %s" to "price: %s" works!!!!!


#6

prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}

for key in prices:
print "price: %s" % prices[key]
print "Stock: %s" % stock[key]

Nope.


#7

prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}

for key in prices:
    total = 0
    print 
    print key
    print "price: %s" % prices[key]
    print "Stock: %s" % stock[key]
print total

guys srsly help me!


#8
print "stock: %s" % stock[key]

#9

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