Answer:
subtotal = 0total = 0tax_rate = 6.5for i in range(1,4): price = float(input("Enter the price for item " + str(i) + ": ")) quantity = int(input("Enter the quantity for item " + str(i) + ": ")) subtotal += (price * quantity)tax = subtotal * tax_rate/100total = tax + subtotalprint("Subtotal: " + str(subtotal) + ", Tax: " + str(tax) + ", Total: " + str(total))
Step-by-step explanation:
- Initialize the variables- Create for loop that iterates 3 times- Ask the user for the price and quantity of each item- Calculate the subtotal with given inputs- When the loop is done, calculate the tax and total- Print the subtotal, tax, and total