Computer Science, asked by ahujavarun106, 8 months ago

Write the python code to input total shopping amount purchased in the shop, and then apply the discount as per

the following discount criteria, then find and print the final amount that has to be paid by the customer

after subtracting the discount amount:

 If user has purchased something that costs from Rs.101 to Rs.200, the discount will be 5%

 If user has purchased something that costs from Rs.201 to Rs.400, the discount will be 10%

 If user has purchased something that costs from Rs.401 to Rs.800, the discount will be 20%

 And if user has purchased something that costs above Rs.800, the total discount that will be applied on

the whole purchase amount is 25%​

Answers

Answered by upendracachet
1

Explanation:

discount based on the sale amount

Ad by Valueimpression

Python | if elif example: Here, we are implementing a program, it will input sale amount and calculate the discount based on input amount.

Submitted by Pankaj Singh, on September 29, 2018

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%

Program:

# input sale amount

amt = int(input("Enter Sale Amount: "))

# checking conditions and calculating discount

if(amt>0):

if amt<=5000:

disc = amt*0.05

elif amt<=15000:

disc=amt*0.12

elif amt<=25000:

disc=0.2 * amt

else:

disc=0.3 * amt

print("Discount : ",disc)

print("Net Pay : ",amt-disc)

else:

print("Invalid Amount")

Output

Enter Sale Amount: 30000

Discount : 9000.0

Net Pay : 21000.0

Answered by Equestriadash
2

choice = "Yes"

while choice == "Yes":

   amt = float(input("Enter your shopping amount: "))

   print()

   if amt > 101 and amt < 200:

       print("You receive a discount of 5%.")

       dst = amt*0.05

       print(amt - dst, "is your net pay.")

   elif amt > 201 and amt < 400:

       print("You receive a discount of 10%.")

       dst = amt*0.10

       print(amt - dst, "is your net pay.")

   elif amt > 401 and amt < 800:

       print("You receive a discount of 20%.")

       dst = amt*0.20

       print(amt - dst, "is your net pay.")

   elif amt > 800:

       print("You receive a discount of 25%.")

       dst = amt*0.25

       print(amt - dst, "is your net pay.")

   print()

   print("Thank you for shopping!")

   print()

   choice = input("Next customer? [Yes/No]: ")

   print()

Attachments:
Similar questions