Q:

Python program to calculate discount based on selling price

belongs to collection: Python basic programs

0

The discount will be calculated as,

  • If the order amount is greater than 100000 is 20%.
  • If the order amount is greater than 50000 and smaller than 100000 is 10%.
  • If the order amount is smaller than 50000 is 5%

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Code:

rate = float(input("Enter Rate : "))
quantity = float(input("Enter Quantity : "))

amount = rate*quantity
print("Amount = ",amount)

if(amount >= 100000):
    discount = 20
elif(amount>=50000 and amount<=99999):
   discount = 10
else:
   discount = 5

discountAmount = (amount*discount)/100
netAmt = amount - discountAmount

print("Discount = %d%% and Discount Amount = %.2f"%(discount,discountAmount))

print("Net Amount = ",netAmt)

Output:

Enter Rate : 500
Enter Quantity : 200
Amount =  100000.0
Discount = 20% and Discount Amount = 20000.00
Net Amount =  80000.0

In the above code, we have taken inputs from users for values of rate and quantity of the product. And the calculate amount by multiplying both using which we have calculated the discount percentage using which the values of discount amount and net payable amount is calculated.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python basic programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Python program to calculate gross pay (Hourly paid... >>
<< Python program to calculate currency notes require...