It looks like your code didn't print the correct total


#1

prices = {
"banana" : 4,
"apple" : 2,
"orange" : 1.5,
"pear" : 3,
}
stock = {
"banana" : 6,
"apple" : 0,
"orange" : 32,
"pear" : 15,
}

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


#2

You should define a function that returns total, not to print the total value.

You can see this topic too.


#3

Thanks for your reply. Luckily it worked the way mentioned above... I was trying to print a message along with the total value earlier.