#Software Sales Assignment #Isaac Martinotti #CIS 122 def main(): #Introduction Message print('This program finds your discount based on number of software packages you plan to buy.') print #Gather Variables packages = int(input("Please enter the number of packages you wish to buy.")) print subtotal = packages * 99 #Decision Tree if packages >= 100 : discount = subtotal * .5 percent = 50 elif packages >= 50 : discount = subtotal * .4 percent = 40 elif packages >= 20 : discount = subtotal * .3 percent = 30 elif packages >= 10 : discount = subtotal * .2 percent = 20 else : discount = 0 percent = 0 #Print Answer if discount == 0 : print('Sorry, your order does not qualify for a discount.') print('Your total is ${}.').format(subtotal) else: print('You qualify for a discount of {}% totaling ${} in savings.').format(percent,discount) print print('Your total is ${}.').format((subtotal - discount)) main() """I originally had the last few lines as: if discount == 0 : print('Sorry, your order does not qualify for a discount.') print('Your total is ${0:.2f}.').format(subtotal) else: print('You qualify for a discount of {}% totaling ${0:.2f} in savings.').format(percent,discount) print print('Your total is ${0:.2f}.').format((subtotal - discount)) main() But it doesn't work on PythonFiddle correctly. It works fine in Pythonista though."""
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