Я написал простой Python, который дает представление о том, как работает система, но общая сумма не рассчитывается. Теперь я хочу получить соответствующее значение (то есть тип конуса, аромат Scoop для каждого ковша и аромат Topping для каждого топинга) и рассчитать общую стоимость и, наконец, отобразить детали, выбранные в деталях (пункт -> цена и количество) и Итоговая сумма.
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},
)