8. keeping track of produce, A Day at the Supermarket - PLS HELP


#1

Uploading...
why the error? whats wrong?

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]

----------------------------------------------------------

orange
prices: 1.5
stock: 32
pear
prices: 3
stock: 15
banana
prices: 4
stock: 6
apple
prices: 2
stock: 0
None

---------------------------------------------------------

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

---------------------------------------------------------

Loop through each key in prices.
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.

When you're printing, you can use the syntax from the example above.


#2

please copy paste your code to the forum, image upload seems to be very slow of late


#3

done... would you be so kind to look at the code?


#4

you have prices, this should be price


#5

works, thank you!!!!


#6