所以我有这个代码:
stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}
prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
def compute_bill(food):
total = 0
for item in food:
item = shopping_list(prices[key])
total += item
return total
shopping_list = ["pear", "orange", "apple"]
total = sum([ prices[s] for s in shopping_list ])
print("Items Purchased")
print("---------------")
for items in shopping_list:
print(items.title() + " @" + )
print("---------------")
print("Total: £{:.2f}".format(total))
我想知道我是否能够打印出每件商品的价格,正如你所看到的,我已经尝试过但没有成功。
潇湘沐
慕容708150
相关分类