Here I have a program that gives the total cost of individual products, multiplying prices and stocks. But what should I use to find the total value of all products combined?
total = 0
prices = {
"banana" : 4,
"apple" : 2,
"orange" : 1.5,
"pear" : 3
}
stock = {
"banana" : 9,
"apple" : 0,
"orange" : 18,
"pear" : 22
}
for i in prices:
print (i.title())
print ("Price:", prices[i])
print ("Stock:", stock[i])
print ("=================")
for key in prices:
print(key.title() + " Total Price:" , prices[key]*stock[key])
source
share