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

0

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

unitprice=int(input("Enter unit price:"))
quantity=int(input("Enter quantity:"))
if quantity>=100 and quantity<=120:
    TotalPrice=float(unitprice*quantity*0.9)
elif quantity>120:
    TotalPrice=float(unitprice*quantity*0.85)
else:
    TotalPrice=float(unitprice*quantity)
print("The revenue from sale: ",TotalPrice,"$")

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