Supermarket exercises-something of value need help


#1

Hello world. Hope you doing well!

I am new to python and I would love to have some help with the following code please:
#I want to know if the last for loop to print out the total is okay please if not how to correct it, thx GUYS!
Exercice link: https://www.codecademy.com/courses/learn-python/lessons/a-day-at-the-supermarket/exercises/something-of-value-?action=resume_content_item

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:
key = prices[key] * stock[key]
total += key
print total


#2

We cannot reuse the iterator variable inside the loop. That will mess with things.

total += prices[key] * stock[key]

#3

Thanks for your precious help dear mtf!