5. Write a python program to accept price of an item and number of quantities sold. If
quantity sold is more than 500, then give them a discount of 10%. If quantity sold is less
than or equal to 500 or more than 250, then give them a discount of 5%. Finally display the
amount payable.
Answers
Answer:
answer please check and write
Program:
price = float(input("Enter price of an item : "))
quantity = int(input("Enter number of quantities sold : "))
if quantity > 500:
amount = price * quantity
discount = amount * 10 / 100
print("Total amount : ", amount)
print("Discount : ", discount)
print("Payable amount :", amount - discount)
elif quantity > 250 and quantity <= 500:
amount = price * quantity
discount = amount * 5 / 100
print("Total amount : ", amount)
print("Discount : ", discount)
print("Payable amount :", amount - discount)
else:
amount = price * quantity
print("Payable amount :", amount)
Output 1:
Enter number of quantities sold : 1000
Total amount : 10000.0
Discount : 1000.0
Payable amount : 9000.0
Output 2:
Enter price of an item : 10
Enter number of quantities sold : 400
Total amount : 4000.0
Discount : 200.0
Payable amount : 3800.0
Output 3:
Enter price of an item : 10
Enter number of quantities sold : 400
Total amount : 4000.0
Discount : 200.0
Payable amount : 3800.0