H.W
prices = {
"box_of_spaghetti" : 4,
"lasagna" : 5,
"hamburger" : 2
}
quantity = {
"box_of_spaghetti" : 6,
"lasagna" : 10,
"hamburger" : 0
}
money_spent = 0
money5=0
moneyl5=0
for i in prices:
money_spent = money_spent + (prices[i]*quantity[i])
if prices[i]== 5:
money5=money5+prices[i]*quantity[i]
elif prices[i]<5:
moneyl5=moneyl5+prices[i]*quantity[i]
print("money for 5 :",money5)
print("money less t5 :",moneyl5)
print("total money spent:",money_spent)
1 answers ( 0 marked as helpful)