# Exercise 9, Something of Value

I literally have no clue what to do for this exercise. I’ve been searching Q and A and have seen other people’s codes and tried to use them to pass this exercise but it is not working. Can anyone check my code and explain what I am supposed to do? Like I said I have no clue and essentially copied other codes trying to get this to work so any explanation would be appreciated!

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]

def compute_bill(food):
total = 0
for x in food:
total += prices*stock
print total

Try this

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]

total = 0

for key in prices:
n = prices[key] * stock[key]
total = n + total
print n
print total

5 Likes

Thank you, that worked