9 - Algo de valor


#1

Não consigo sair desse exercicio .
Meu valor do print ta voltando tudo 0.
prices = {
"banana" : 4,
"maca" : 2,
"laranja" : 1.5,
"pera" : 3,
}
stock = {
"banana" : 6,
"maca" : 0,
"laranja" : 32,
"pera" : 15,
}

for prod in prices:
print prod
print "price: %s" % str(prices[prod])
print "stock: %s" % str(stock[prod])
total = 0
for i in prices:
print (prices[prod])*stock[prod])


#2

cara consegui assim
prices = {
"banana": 4,
"maca": 2,
"laranja": 1.5,
"pera": 3,
}
stock = {
"banana": 6,
"maca": 0,
"laranja": 32,
"pera": 15,
}

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

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

print (total)