IDNLearn.com: Where your questions meet expert advice and community insights. Ask anything and receive immediate, well-informed answers from our dedicated community of experts.
Sagot :
Answer:
Name: tyler
Number of pizzas: 2
Small (10 inch, $7.95), Medium (12 inch, $9.95), and Large (14 inch, $11.95)
Pizza size: large
Available toppings: Ham, Mushrooms, Onions, Green Peppers, Black Olives, Tomatoes, Pineapple, Spinach
$0.75 each for Small Pizza, $0.95 each for Medium Pizza, and $1.15 each for Large Pizza
Number of toppings: 2
Enter topping number 1: ham
Enter topping number 2: onions
Order Summary:
Customer Name: tyler
2 large pizzas with ['ham', 'onions']
Subtotal | Sales Tax (6%) | Total Cost
26.2 | 1.5719999999999998 | 27.772
Explanation:
name = input("Name: ")
num_pizzas = int(input("Number of pizzas: "))
print("Small (10 inch, $7.95), Medium (12 inch, $9.95), and Large (14 inch, $11.95)")
pizza_size = input("Pizza size: ").lower()
print("Available toppings: Ham, Mushrooms, Onions, Green Peppers, Black Olives, Tomatoes, Pineapple, Spinach")
print("$0.75 each for Small Pizza, $0.95 each for Medium Pizza, and $1.15 each for Large Pizza")
num_toppings = int(input("Number of toppings: "))
toppings = []
subtotal = 0
tax = 0
total = 0
for i in range(1,num_toppings + 1):
toppings.append(input(f"Enter topping number {i}: "))
if pizza_size == 'small':
subtotal += num_pizzas * 7.95
subtotal += num_toppings * 0.75
tax += subtotal * 0.06
total += subtotal + tax
print("Order Summary: ")
print(f"Customer Name: {name}")
print(f"{num_pizzas} {pizza_size} pizzas with {toppings}")
print("Subtotal | Sales Tax (6%) | Total Cost")
print(f"{subtotal} | {tax} | {total}")
if pizza_size == 'medium':
subtotal += num_pizzas * 9.95
subtotal += num_toppings * 0.95
tax += subtotal * 0.06
total += subtotal + tax
print("Order Summary: ")
print(f"Customer Name: {name}")
print(f"{num_pizzas} {pizza_size} pizzas with {toppings}")
print("Subtotal | Sales Tax (6%) | Total Cost")
print(f"{subtotal} | {tax} | {total}")
if pizza_size == 'large':
subtotal += num_pizzas * 11.95
subtotal += num_toppings * 1.15
tax += subtotal * 0.06
total += subtotal + tax
print("Order Summary: ")
print(f"Customer Name: {name}")
print(f"{num_pizzas} {pizza_size} pizzas with {toppings}")
print("Subtotal | Sales Tax (6%) | Total Cost")
print(f"{subtotal} | {tax} | {total}")
We value your participation in this forum. Keep exploring, asking questions, and sharing your insights with the community. Together, we can find the best solutions. Find the answers you need at IDNLearn.com. Thanks for stopping by, and come back soon for more valuable insights.