A software company sells a package that retails for $99. Quantity discounts are given according to the following table:
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.
COMPLETE PYTHON CODE:
# Ask the user to enter the number of packages purchased
package_purchased = int(input("Enter number of packages purchased: "))
# Calculate the discount
if package_purchased >= 10 and package_purchased <= 19:
discount = 0.2 * package_purchased * 99
elif package_purchased >= 20 and package_purchased <= 49:
discount = 0.3 * package_purchased * 99
elif package_purchased >= 50 and package_purchased <= 99:
discount = 0.4 * package_purchased * 99
elif package_purchased >= 100:
discount = 0.5 * package_purchased * 99
else:
discount = 0
# Calculate total purchase after discount
total_purchase = package_purchased * 99 - discount
# Display the results
print("Discount: $" + str(discount))
print("Total purchase after discount: $" + str(total_purchase))
OUTPUT 1:
Enter number of packages purchased: 150
Discount: $7425.0
Total purchase after discount: $7425.0
OUTPUT 2:
Enter number of packages purchased: 25
Discount: $742.5
Total purchase after discount: $1732.5