A departmental store offers various festival discounts on different categories of items as
follows:
Category
>=20000
>=15000
>=10000
amou
nt
electronics
10%
8%
5%
garments
20%
7%
3%
Enter total purchase amount and category as "1" for electronics or "2" for garments; calculate discount and net payable amount as amount list
Answers
The following cσdes have been written using Python.
while True:
print("1. Electronics")
print("2. Garments")
print("3. Exit")
print()
c = int(input("Enter your choice: "))
print()
if c == 1:
p = float(input("Enter your amount of purchase: "))
print()
if p >= 20000:
d = 0.10
ta = p - (p*d)
print(ta, "is your total amount.")
print()
elif p >= 15000:
d = 0.8
ta = p - (p*d)
print(ta, "is your total amount.")
print()
elif p >= 10000:
d = 0.5
ta = p - (p*d)
print(ta, "is your total amount.")
print()
elif c == 2:
p = float(input("Enter your amount of purchase: "))
print()
if p >= 20000:
d = 0.20
ta = p - (p*d)
print(ta, "is your total amount.")
print()
elif p >= 15000:
d = 0.7
ta = p - (p*d)
print(ta, "is your total amount.")
print()
elif p >= 10000:
d = 0.3
ta = p - (p*d)
print(ta, "is your total amount.")
print()
elif c == 3:
break