Question: ********PYTHON******** Write a Python function that takes as input parameters base_cost (a float) and customer_type and prints a message with information about the total amount
********PYTHON********
Write a Python function that takes as input parameters base_cost (a float) and customer_type and prints a message with information about the total amount owed and how much the tip was.
As a reminder, the tip amounts are 10%, 15% and 20% for stingy, regular, and generous customers. And the tax amount should be 7%.
The total amount is calculated as the sum of two amounts:
check_amount = base_cost*1.07
tip_amount = tip_percentage*check_amount
To receive full credit, you must use string formatting to print out the result from your function, and your amounts owed should display only 2 decimal places (as in the examples below). To "pretty print" the float to a desired precision, you will need to use this format operator (refer back to class slides for more explanation): %.2f
Print the results to the console like in the example below, including the base cost of the meal, tax, three tip levels, and total for regular customers.
Test cases:
inputs: check_amount = 20, customer_type = "regular" --> output: Total owed by regular customer = $24.61 (with $3.21 tip)
inputs: check_amount = 26.99, customer_type = "generous" --> output: Total owed by generous customer = $34.66 (with $5.78 tip)
inputs: check_amount = 26.99, customer_type = "generous" --> output: Total owed by stingy customer = $16.83 (with $1.53 tip)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
