8. Keeping track of produce *orange problem


#1

prices = {
    'banana': 4,
    'apple': 2,
    'orange': 1.5,
    'pear': 3
}

stock = {
    'banana': 6,
    'apple': 0, 
    'orange': 32,
    'pear': 15
}
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]

The error message reads : Check what your code prints for orange. It doesn't look quite right!
And I'm at a loss. Thanks in advanced.


#2

The instructions are very specific.

02. Like the example above, for each key, print out the key along with its price and stock information. Print the answer in the following format:
apple
price: 2
stock: 0
Like the example above, because you know that the prices and stock dictionary have the same keys, you can access the stock dictionary while you are looping through prices.

Meaning, you need to lowercase your price and stock in your print statements.


#3

OMG thank you so much!!!


#4

Thanks bro. :slight_smile:


#5

A post was split to a new topic: Still problem


#6

please, anyone help me....even after lowercase its showing error.


#7

can you please tell me how it is applied to that code??....i'm stucked!!!!


#8

#9

Please go here, press the make a new topic button, fill in the template (we need this information to help you), then someone will help you