we have a program that evaluates and adds the content of one list but we want a function that evaluates and adds for an arbitrary amount of lists. right now, if I input cost_calculator(["olive","ham"]), this would return the price which is 15.00
What I want is for me to input cost_calculator(["olive","ham"],["mushroom"]) and give me the price of two pizzas with those toppings which is 28.50
Any ideas of what I am doing wrong or need to put in?
What I want is for me to input cost_calculator(["olive","ham"],["mushroom"]) and give me the price of two pizzas with those toppings which is 28.50
Any ideas of what I am doing wrong or need to put in?
def cost_calculator(in_list):
cost_pizza = 0
cost_pizza += 13.00
pepperoni = ["pepperoni"]
mushroom =["mushroom"]
olive = ["olive"]
anchovy = ["anchovy"]
ham = ["ham"]
for item in in_list:
if item in pepperoni:
cost_pizza += 1.00
if item in mushroom:
cost_pizza += .50
if item in olive:
cost_pizza += .50
if item in anchovy:
cost_pizza += 2.00
if item in ham:
cost_pizza += 1.5
return cost_pizza
