"""====================================================================== Program: Total Purchase Author: Chris Brockamp Date: April 9, 2015 Dev Env: Python Fiddle Description: Projects a company's annual profit given the user provides total projected sales. ======================================================================""" #set sales tax to a constant SALES_TAX = .06 print "*** Cash Register #1 ***" #gets price of 5 items from user item_one = float(input("Enter the price of item one: $")) print("%.2f" % item_one) item_two = float(input("Enter the price of item two: $")) print("%.2f" % item_two) item_three = float(input("Enter the price of item three: $")) print("%.2f" % item_three) item_four = float(input("Enter the price of item four: $")) print("%.2f" % item_four) item_five = float(input("Enter the price of item five: $")) print("%.2f" % item_five) #calculates and displays the subtotal price for the items entered subtotal = item_one + item_two + item_three + item_four + item_five print("Subtotal: $%.2f" % subtotal) #calculates and displays the total sales tax total_tax = subtotal * SALES_TAX print("Sales Tax: $%.2f" % total_tax) #calculates total cost of items entered by user total_cost = subtotal + total_tax print("Total Cost: $%.2f" % total_cost)
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