Code and instructions found here
shopping_list = ["banana", "orange", "apple"]
stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}
prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
# Write your code below!
def compute_bill(food):
total = 0
for item in food:
total += item
return total
上面是我的代码,我知道它需要找到值,但即使我尝试食品.价值观()它给出了一个错误。我怎样才能做到这一点?你知道吗
谢谢
你应该把你的代码作为代码/文本,而不是图片! 不管怎样,一个没有任何检查/验证的非常原始的实现应该是这样的:
输出:
总计:5.5
相关问题 更多 >
编程相关推荐