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
![](https://hi-static.z-dn.net/files/db0/01db7d89bfec601bfb708156547390a2.jpg)
![](https://hi-static.z-dn.net/files/d28/f1728c2a9916c8eee65ac821855b4347.jpg)
![](https://hi-static.z-dn.net/files/d67/47765b088342576d3ae6bdb163b6eb43.jpg)
![](https://hi-static.z-dn.net/files/d03/43503b385fc8330ce0481c8753248285.jpg)
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