Robotics & Artificial Intelligence

Write a program in Python that accepts the name and price of a product and calculates the net amount to be paid by a customer, based on the following criteria:

Product PriceDiscount
<10000%
1000-50002%
5001-150003%
15001-250005%
25001-5000010%
>5000012%

Python Control Flow

2 Likes

Answer

name = input("Enter product name: ")
price = float(input("Enter product price: "))

if price < 1000:
    discount = 0
elif price <= 5000:
    discount = 2 / 100
elif price <= 15000:
    discount = 3 / 100
elif price <= 25000:
    discount = 5 / 100
elif price <= 50000:
    discount = 10 / 100
else:
    discount = 12 / 100

discount_amount = price * discount
net_amount = price - discount_amount

print("Product Name:", name)
print("Original Price:", price)
print("Discount Amount:", discount_amount)
print("Net Amount to be Paid:", net_amount)

Output

Enter product name: Mobile Phone
Enter product price: 20000
Product Name: Mobile Phone
Original Price: 20000.0
Discount Amount: 1000.0
Net Amount to be Paid: 19000.0

Answered By

3 Likes


Related Questions