Question: import math # Step 1 : Read inputs num _ people = int ( input ( ) ) avg _ slices _ per _ person

import math # Step 1: Read inputs num_people = int(input()) avg_slices_per_person = float(input()) cost_per_pizza = float(input()) # Calculate the total number of slices needed total_slices_needed = num_people * avg_slices_per_person # Calculate the number of whole pizzas needed (8 slices per pizza) num_pizzas = math.ceil(total_slices_needed /8) # Calculate the cost for all pizzas cost_of_pizzas = num_pizzas * cost_per_pizza # Step 2: Calculate the sales tax (7%) tax = cost_of_pizzas *0.07 # Calculate the delivery charge (20% of cost including tax) delivery_charge =(cost_of_pizzas + tax)*0.20 # Step 3: Calculate the total cost total_cost = cost_of_pizzas + tax + delivery_charge # Output the results print(f"Pizza Night Party {num_pizzas} Pizzas: ${cost_of_pizzas:.2f} Tax: ${tax:.2f} Delivery: ${delivery_charge:.2f} Total: ${total_cost:.2f}")

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!