Python program to calculate the discount based on the bill.

In this python if else program, we will calculate the discount on the amount based on the bill.

Steps to solve the program
  1. Take the bill amount as input through the user and create a variable and assign its value equal to 0.
  2. Using an if-else statement find how much discount is applicable (i.e. 10% discount if the bill is more than 1000, and 20% if the bill is more than 2000).
  3. Calculate the discount using the formula discount %*(bill amount/100) and store the result in the variable that we have created at the beginning of the program.
  4. Print the output.
				
					bill = int(input("Enter bill amount: "))
discount = 0

if bill >= 2000:
    discount = 20*(bill/100)
elif 1000<= bill < 2000:
    discount = 10*(bill/100)
    
print("Discount amount: ",discount)
				
			

Output :

				
					Enter bill amount: 1500
Discount amount:  150.0
				
			

Related Articles

check if the input shape is sqaure or not.

print the absolute value of a number defined by the user.

Leave a Comment