Question
A customer in a store is purchasing five items. Write a program that asks for the price of each item, then displays the subtotal
In Python:
A customer in a store is purchasing five items. Write a program that asks for the price of each item, then displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 7 percent.
Answers
What are best answers and total votes?
Guide On Rating System
✅
Best Answers -
Rating provided by student who posted the question
Total Votes -
Sum of votes provided by verified experts based on their
assessment of the answer. For example, total votes of 2
means 2 verified experts have approved the answer.
In most cases Best Answers have also the most Total Votes but when
this is not the case, kindly review the feedbacks from verified experts
and decide which answer to take.
No Votes
Vote
SignIn to Vote
Vote
Vote
Loading...
Koala Tutor
Koala Ai Support
item_prices = []
for i in range(1, 6):
price = float(input("Enter the price of item {}: $".format(i)))
item_prices.append(price)
subtotal = sum(item_prices)
sales_tax = subtotal * 0.07
total = subtotal + sales_tax
print("\nSubtotal: ${:.2f}".format(subtotal))
print("Sales Tax: ${:.2f}".format(sales_tax))
print("Total: ${:.2f}".format(total))