你能不能给我一些提示我如何存储将在最后一个代码的输出上显示的食物,如果我使用列表存储和/或我应该使用字典,还必须存储它的数量和价格它的。谢谢
客户选择产品后 加入购物篮,程序会询问金额。
inventory={'asparagus':[10,5],'broccoli':[15,6],'carrots':[18,7],
'apples':[20,5],'banana':[10,8],'berries':[30,3],
'eggs':[50,2],'mixed fruit juice':[0,8],'fish sticks':[25,12],
'ice cream':[32,6], 'apple juice':[40,7], 'orange juice':[30,8],
'grape juice':[10,9]}
menu_list=["1. Search for the product", "2. See the basket","3. Check Out","4. Logout","5. Exit"]
def return_to_main():
digit = 1
for i in menu_list:
print i
main_menu=raw_input("Please choose one of the following services")
if main_menu=="1":
select=raw_input("Search for the product")
for food in inventory:
if select in food:
print str(digit)+".",food,inventory[food][0]
digit+=1
return_to_main()