# This program calculates the subtotal, sales tax, and total sale amount for a purchase # Written by Beth Mela # Last edited on April 2, 2015 # Request the price of each item ItemOnePrice=float(raw_input('Please enter the price of item one')) print("$",ItemOnePrice) ItemTwoPrice=float(raw_input('Please enter the price of item two')) print("$",ItemTwoPrice) ItemThreePrice=float(raw_input('Please enter the price of item three')) print("$",ItemThreePrice) ItemFourPrice=float(raw_input('Please enter the price of item four')) print("$",ItemFourPrice) ItemFivePrice=float(raw_input('Please enter the price of item five')) print("$",ItemFivePrice) # Define the value of sales tax SalesTax=0.06 # Calculate the subtotal for the sale SubtotalSale=ItemOnePrice+ItemTwoPrice+ItemThreePrice+ItemFourPrice+ItemFivePrice print("The subtotal for this sale is $",SubtotalSale) # Calculate the tax for the sale AmountOfSalesTax=(SalesTax*SubtotalSale) print("The amount of sales tax for this sale is $",AmountOfSalesTax) # Calculate the total sale TotalSale=(SubtotalSale+AmountOfSalesTax) print("The total sale is for $",TotalSale)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question