Percentage Discount Calculator in Python

Percentage Discount Calculator: Here, we are implementing a program, it will input sale amount and calculate the discount based on input amount using nested if else. By Pankaj Singh Last updated : April 10, 2023

Percentage Discount Calculator Implementation

Input same amount and calculate discount based on the amount and given discount rate in Python.

The discount rates are:

Amount       Discount
0-5000          5%
5000-15000      12%
15000-25000     20%
above 25000     30%

Python Code for Percentage Discount Calculator

# input sale amount 
amt = int(input("Enter Sale Amount: "))

# conditions to check amount and get discount
if(amt>0):
    if amt<=5000:
       disc = amt*0.05
    else:
        if amt<=15000:
            disc=amt*0.12
        else:
            if amt<=25000:
                disc=0.2 * amt
            else:
                disc=0.3 * amt
    
    # printing discount and net payable amount 
    print("Discount : ",disc)
    print("Net Pay  : ",amt-disc)
else:
    print("Invalid Amount")

Output

Enter Sale Amount: 22000
Discount :  4400.0
Net Pay  :  17600.0

Python Basic Programs »


Related Programs

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.