Question
Write a simple python program that asks the user for a series of product prices. Compute sales tax (7%) on each price and print out
Write a simple python program that asks the user for a series of product prices. Compute sales tax (7%) on each price and print out the new price to the user. Next, ask the user if they want to enter another price - if they do, repeat the process. If not, end the program. and modify the same program so that your program also keeps track of the total amount spent in addition to the total tax due.
I have asked this question prior and the person posted this below program however after entering each price it has to compute the tax immediately but for the below program tax is computed later. Also kindly write the program without CREATING A EMPTY LIST(which is second step in this case)
num = int(input("Enter the number of Products : ")) # l=[] for i in range(0,num): price = int(input("Enter the price of product = ")) # l.append(price) for i in range(0,num): total_price = l[i] + (l[i] * 0.07) print("price of ",i," product = ",total_price) while(True): choice = input("You want to continue? (Y or N) : ") if(choice == 'N' or choice == 'n'): break price1 = int(input("Enter the price of product = ")) total_price = price1 + (price1*0.07) print("price of product = ",total_price)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started