Q:

Write a Python program to calculate the revenue from a sale based on the unit price and quantity of a product input by the user

-1

Write a Python program to calculate the revenue from a sale based on the unit price and quantity of a product input by the user.

The discount rate is 10% for the quantity purchased between 100 and 120 units, and 15% for the quantity purchased greater than 120 units. If the quantity purchased is less than 100 units, the discount rate is 0%. See the example output as shown below.

 

 

Example

 

Input:

Enter unit price: 25

Enter quantity: 110

Output:

The revenue from sale: 2475.0$

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

price=float(input("Enter price: "))
qty=float(input("Enter quantity: "))

revenue=price*qty
if revenue < 100:
    discount=revenue;
elif (100< revenue < 120):
    discount=revenue*10/100
elif revenue > 120:
    discount=revenue*15/100;
  
net_rev=revenue-discount

print("The revenue from sale: ",revenue,"$")

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now