[PYTHON] A software company sells a package that retails for $99

PYTHON: A software company sells a package that retails for $99. Quantity discounts are given according to the following table:

A software company sells a package that retails for $99

Write a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.

Answer

  1. packages = eval(input("Enter the number of packages purchased: "))
  2. result = 0
  3. if packages >= 100:
  4. result = packages - (40*packages/100)
  5. elif packages>=50:
  6. result = packages - (30 * packages / 100)
  7. elif packages>=20:
  8. result = packages - (20 * packages / 100)
  9. elif packages>=10:
  10. result = packages - (10 * packages / 100)
  11. else:
  12. result = packages
  13. result = result*99
  14. print("Total amount of the purchase after the discount:",result)

Output

A software company sells a package that retails for $99 output

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts