#This program generates a total based on 5 items that are entered by the user item1=input("Cost of your first item:") item2=input("Cost of your second item:") item3=input("Cost of your third item:") item4=input("Cost of your fourth item:") item5=input("Cost of your fifth item:") total=(item1+item2+item3+item4+item5) #This equation finds the subtotal salestax=.06 #This is the current sales tax of 6% calc=(item1+item2+item3+item4+item5)*salestax #This equation finds the correct tax amount sum=(calc+total) #This equation applies the correct tax amount to the subtal for a grand total print ('Subtotal' , total) print ('Sales Tax' , salestax) print ('Total' , sum)
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