In this python if else program, we will calculate the discount on the amount based on the bill.
Steps to solve the program
- Take the bill amount as input through the user and create a variable and assign its value equal to 0.
- 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).
- 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.
- 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