item1 = raw_input('Please enter the price of the first item: ') #asks for input for first item print item1 #displays item2 = raw_input('Please enter the price of the second item: ') #asks for input for second item print item2 #displays item3 = raw_input('Please enter the price of the third item: ') #asks for input for third item print item3 #displays item4 = raw_input('Please enter the price of the fourth item: ') #asks for input for fourth item print item4 #displays item5 = raw_input('Please enter the price of the fifth item: ') #asks for input for fifth item print item5 #displays subtotal = int(item1) + int(item2) + int(item3) + int(item4) + int(item5) #adds the cost of all the items together print ('The subtotal is ' + str(subtotal) + ' dollars.') #displays tax = float(subtotal) * 0.06 #calculates tax print ('The tax is ' + str(tax) + ' dollars.') #displays total = float(subtotal) + tax #calculates total print ('The total is ' + str(total) + ' dollars.') #displays
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