# Assignment 3 exercise 7 # Calculates discount based on bulk purchase # Cory Parker 4/13/15 sales=input ('Enter the number of packages you will be purchasing: ') print (sales) swpackage=float(99.00) grandtotal=(sales*swpackage) if (sales<=9): discount=(sales * swpackage * float(0)) elif (sales>=10 and sales<=19): discount=(sales * swpackage * float(0.2)) elif (sales>=20 and sales<=49): discount=(sales * swpackage * float(0.3)) elif (sales>=50 and sales<=99): discount=(sales * swpackage * float(0.4)) elif (sales<=100): discount=(sales * swpackage * float(0.5)) grosstotal=(sales*swpackage-discount) #This section displays the output print("You have purchased {} packages!").format(sales) print("You're total is {}").format(grandtotal) print("You've recieved a discount of ${:,.2f}").format(discount) print("Which makes your grand total ${:,.2f}".format(grosstotal))
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