 # Input purchase price and calculate discount in Python

###### if elif - Question 11

In this question, we will see how to input the purchase amount and print the discount amount and the net bill amount after deducting the discount amount in Python programming using the if elif statement. To know more about if elif statement click on the if elif statement lesson.

Q11) A showroom gives discount according to the following slab rates on the purchase amount.

 Purchase Amount Discount Up to 5,000 No Discount 5,001 to 10,000 10% of the amount exceeding 5000 10,001 to 20,000 20% of the amount exceeding 10,000 20,001 to 30,000 30% of the amount exceeding 20,000 More than 30,000 40% of the amount exceeding 30,000

Write a program in Python to input the purchase amount and print the discount amount and the net bill amount after deducting the discount amount.

#### Program

``````p=int(input('Enter purchase amount '))

if p<=5000:
dis=0
elif p>5000 and p<=10000:
dis=(p-5000)*(10/100.0)
elif p>10000 and p<=20000:
dis=(p-10000)*(20/100.0)
elif p>20000 and p<=30000:
dis=(p-20000)*(30/100.0)
else:
dis=(p-30000)*(40/100.0)

print('Discount Amount = {:.2f}'.format(dis))
print('Net Bill Amount = {:.2f}'.format(p-dis))``````

#### Output

```Enter purchase amount 25648
Discount Amount = 1694.40
Net Bill Amount = 23953.60``` 