Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python, A customer in a store is purchasing items. Write a program, using a while loop, that asks for the price of each item,

In python, A customer in a store is purchasing items. Write a program, using a while loop, that asks for the price of each item, then displays the subtotal of the sale, the amount of sales tax, and the total when the customer is done entering all the items. Assume the sales tax is 7 percent. The customer should be allowed to enter as many items as they wish. The while loop should terminate when the user hit the key (Return) on the keyboard. (Hint: Use a null or empty string). Optionally, if you would like to round the dollar amount to two decimal places, you can use output formatting construct in your print statement. For example: print("Sales tax: ", format(sales_tax, '.2f')) will round to two decimal places.

Expected Output:

Enter the item price or to end: 22.50 Enter the item price or to end: 1.99 Enter the item price or to end: 45.30 Enter the item price or to end: 70 Enter the item price or to end: 5 Enter the item price or to end: Subtotal of items purchased: 144.79 Sales tax: 10.14 Total of items purchased: 154.93

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

LO5.2 Discuss government failure and explain why it happens.

Answered: 1 week ago