softwareAmount = input('Please type how many software packages you are purchasing: ') print softwareAmount if softwareAmount >= 10 and softwareAmount <= 19: #depending on user input, the calculations change softwarePrice = softwareAmount * 99 print "The total price of your purchase is: $" + str(softwarePrice) + "." softwareDiscount = softwarePrice * .20 finalPrice = float(softwarePrice) - float(softwareDiscount) print "Your discount is $" + str(softwareDiscount) + "." print "The final cost of your purchase is $" + str(finalPrice) + "." elif softwareAmount >= 20 and softwareAmount <= 49: softwarePrice = softwareAmount * 99 print "The total price of your purchase is: $" + str(softwarePrice) + "." softwareDiscount = softwarePrice * .30 finalPrice = float(softwarePrice) - float(softwareDiscount) print "Your discount is $" + str(softwareDiscount) + "." print "The final cost of your purchase is $" + str(finalPrice) + "." elif softwareAmount >= 50 and softwareAmount <= 99: softwarePrice = softwareAmount * 99 print "The total price of your purchase is: $" + str(softwarePrice) + "." softwareDiscount = softwarePrice * .40 finalPrice = float(softwarePrice) - float(softwareDiscount) print "Your discount is $" + str(softwareDiscount) + "." print "The final cost of your purchase is $" + str(finalPrice) + "." elif softwareAmount >= 100: softwarePrice = softwareAmount * 99 print "The total price of your purchase is: $" + str(softwarePrice) + "." softwareDiscount = softwarePrice * .50 finalPrice = float(softwarePrice) - float(softwareDiscount) print "Your discount is $" + str(softwareDiscount) + "." print "The final cost of your purchase is $" + str(finalPrice) + "." else: #if the software purchase is not large enough, no discount softwareAmount < 10 softwarePrice = softwareAmount * 99 print "You are not eligible for any discounts." print "The total price of your purchase is: $" + str(softwarePrice) + "."
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