subject

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. You may recognize this program from HW1. We'll write a very similar program, just modifying it and using string formatting. Feel free to copy/paste code from before and modify it. 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)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:10
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
question
Computers and Technology, 23.06.2019 17:10
Ac++an of of pi. in , pi is by : pi = 4 – 4/3 + 4/5 – 4/7 + 4/9 - 4/11 + 4/13 - 4/15 + 4/17 . ., to pi (9 ). , if 5 to pi,be as : pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 = 4 – 1. + 0.8 - 0. + 0. = 3.. atoofbe to pi?
Answers: 2
question
Computers and Technology, 24.06.2019 03:30
What is the purpose of a computer network needs assessment? to analyze which workers need more training to improve their performance to compare worker productivity to determine what steps employees can take to increase company revenue to evaluate how to move from the current status to the desired goal
Answers: 2
question
Computers and Technology, 24.06.2019 05:30
How do i get rid of my member ship for
Answers: 2
You know the right answer?
Write a Python function that takes as input parameters base_cost (a float) and customer_type and pri...
Questions
question
Mathematics, 27.10.2020 19:10
question
Biology, 27.10.2020 19:10
question
Mathematics, 27.10.2020 19:10
question
Arts, 27.10.2020 19:10
question
Mathematics, 27.10.2020 19:10
question
Mathematics, 27.10.2020 19:10