Question: What am I missing for my python program to run? def display _ menu ( ) : print ( Welcome to Sammy's Pizzas )

What am I missing for my python program to run?
def display_menu():
print("Welcome to Sammy's Pizzas")
print("What size pizza would you like?")
print("1. Small Cheese Pizza- $8")
print("2. Medium Cheese pizza- $10")
print("3. Large Cheese Pizza- $12")
def get_pizza_size():
while True:
try:
choice= int(input("Enter the number of what size you would like: "))
if choice in [1,2,3]:
return choice
else:
print("Invalid choice. Please use 1,2, or 3")
except ValueError:
print("Invalid input please try again")
def get_toppings():
print("Each topping is $1 more")
print ("Your toppings choice is
1.Sausage
2. Pepperoni
3.Olives.")
toppings ={"pepperoni": 0, "sausage": 0, "olives": 0}
while True:
try:
choice= int(input("Enter the number of your desired topping. "))
if choice in [1,2,3]:
print (f"Great you chose {choice}.")
return choice
else:
print("Invalid choice. Please use 1,2, or 3")
except ValueError:
print("Invalid input please try again")
def calculate_cost (size, toppings):
base_prices ={1:8,2:10,3:12}
cost = base_prices[size]
for topping in toppings.values():
cost += topping
return cost
def main():
display_menu()
size = get_pizza_size()
toppings = get_toppings()
total_cost = calculate_cost()
print(f"Your total cost is ${total_cost:2f}")
if __name__=="__main__":
main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!