Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Shakib Al Hasan is building his tip calculator for whenever he goes eating in a restaurant. In Bangladesh, it's usual to tip 15% if the

Shakib Al Hasan is building his tip calculator for whenever he goes eating in a restaurant. In Bangladesh, it's usual to tip 15% if the bill value is between 50 and 300. In other countries, it is 20% if the bill value is between 50 and 300. Write a Python program that takes a string as input consisting of several restaurant bills (comma separated) between the mentioned range and calculates each total bill updated by adding with the tip value in a separate list. Then print the new list. Note that the first element of the input should be the location. Finally, print the total tip separately. ----------------------------------------------------- Sample Input 1: Bangladesh, 200, 45, 250, 170, 90 Sample Output 1: [230.0, 45, 287.5, 195.5, 103.5] Total tip: 106.5 Explanation1: Since the location is Bangladesh, then the tip would be 15% between 50 and 300. If you apply the given conditions in your code, you will be able to generate the output list (total bill with tip). And, the total amount of tip is 30 + 0 + 37.5 + 25.5 + 13.5 = 106.5 ----------------------------------------------------- Sample Input 2: USA, 20, 150, 80, 33 Sample Output 2: [20, 180.0, 96.0, 33] Total tip: 46 Explanation2: Since the location is not Bangladesh, then the tip would be 20% between 50 and 300. If you apply the given conditions in your code, you will be able to generate the output list (total bill with tip). And, the total amount of tip is 0 + 30 + 16 + 0 = 46

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

c. Will leaders rotate periodically?

Answered: 1 week ago