quantity = int(input("Enter the number of packages purchased. ")) before_discount = quantity*99 if(quantity>9 and quantity<20): discount = before_discount*.20 total = before_discount - discount print("If you buy {} package(s), your discount is ${} and your total is ${}.".format(quantity,discount,total)) elif(quantity>19 and quantity<50): discount = before_discount*.30 total = before_discount - discount print("If you buy {} package(s), your discount is ${} and your total is ${}.".format(quantity,discount,total)) elif(quantity>49 and quantity<100): discount = before_discount*.40 total = before_discount - discount print("If you buy {} package(s), your discount is ${} and your total is ${}.".format(quantity,discount,total)) elif(quantity>99): discount = before_discount*.50 total = before_discount - discount print("If you buy {} package(s), your discount is ${} and your total is ${}.".format(quantity,discount,total))
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