Question: Loops in Python: Use loops to help with calculating sales tax of item prices Program Requirements: 1. Create a While Loop to allow for the

Loops in Python: Use loops to help with calculating sales tax of item prices

Program Requirements: 1. Create a While Loop to allow for the Input of item prices Create a while loop that keeps the program running to allow input of individual item prices until the user chooses to stop entering prices by entering a 0. While Loop Requirements: Convert the string input provided by the user into an appropriate data type for calculating numbers with decimal places Provide error checking of the input conversion using try and except. If an exception occurs, print an error message and then continue with the while loop. Do not exit or gracefully end the program. Append the entered value to a list object that stores the individual prices If a 0 is entered for a price, the while loop will no longer be true.

2. Create a For Loop to read the item prices and sum them together Create a for loop that will read in each price that was appended to the list and add them together for a total pre-tax price.

3. Calculate the total sales tax and print the results Determine the total sales tax and print that amount to the screen. Print the total amount to the screen as well. Requirements: Sales tax for this lab will be equal to 5.75% Test your program by entering the following prices: $2.99, $7.50, $29.99, and $6.99 The sales tax for the test prices will be $2.73, if your code is correct The total bill will be $50.20 if your code is correct

Round the amounts to the nearest penny when printing and include the $ The results are to be printed to the screen as follows:

EXAMPLE: The sales tax was $<SALES TAX AMOUNT> and the total bill is $<TOTAL AMOUNT>.

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 Databases Questions!