A Day at the supermarket - where is the problem? I'm near to solving it


#1





Error code: Oops, try again. Check what your code prints for orange. It doesn't look quite right!

Should say: Done. Move on to the next lesson.
Where am I going wrong? Shouldn't I scan for everything and it finds me stock and prices? I'm stumped. Doesn't look like there is a problem.

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


#2

price should be singular, not plural, in the string.

the output called for is very specific


#3

you should print the price fist and then the stock

also, it should be price, not prices


#4

actually i thought that price should come first as well, but when i tested it with stock first, that worked too, so the only real issue is that price is prices.


#5

for an exercise that is so strict in the validation, that come as a surprise.


#6

Wow that was a quick reply. Thanks guys, plural problem fixed!


#7

sometimes you get lucky if there are helpers online. Plus you made a good topic (exercise url, code (with markup), error message) makes our job a lot easier (and as reward you get faster help :slight_smile:

Good you got it fixed :slight_smile:


#8

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