我写了简单的python,它给出了系统如何执行的想法,但没有计算总数。现在我想要的是获得相应的值(即锥形类型、每个勺的勺子风味和每个浇头的顶部风味)并计算总成本,最后显示详细选择的项目(项目-->价格和数量)和总和。
customername = input("Enter the customer's name....")
ic_no = int(input("Enter the number of ice-creams you want to buy"))
total = {}
for i in range(1, ic_no + 1):
print("For item ", i)
cone = int(input("Enter the cone type: "))
scoop = int(input("Enter the scoop amount: "))
for j in range(1, scoop+1):
#select flavor type for each scoop
flavor = int(input("Entr No."+ str(j) +" flavor"))
topping = int(input("Entr the toppings amount: "))
for k in range(1, topping+1):
#select flavor type for each topping
top_flavor = int(input("Entr No." + str(k) +" topping flavor"))
print("Total price is ", total)
我想简单地通过传递数字来获取选定的项目。例如:1 表示“普通”锥型。
cone_type = (
{"name": "Plain", "price": 2},
{"name": "Wafle", "price": 3},
)
scoop_flavor = (
{"name": "Mint", "price": 1},
{"name": "Caramel", "price": 1},
{"name": "Chocolate", "price": 1},
{"name": "Apple", "price": 1},
)
topping_flavor = (
{"name": "Chocolate", "price": 1},
{"name": "Caramel", "price": 0.5},
{"name": "Peanut", "price": 0.5},
{"name": "Coconut Sprinkle", "price": 0.25},
)