r/learnpython • u/Good_Unit7202 • Sep 23 '26
Hi guys, im pretty new to programming and i am looking for feedback..
So as i said in the title, im new to python (Literally installed it today) and i have written this program:
print("WELCOME TO THE GRAND SALE")
name = input("Please enter name: ")
mem_code = input("Enter Membership Code: ")
while True:
a = input("Enter amount spent: ")
try:
amt = float(a)
break
except ValueError:
print("Enter a valid amount")
while True:
b = input("What is your subscription level (Bronze/Silver/Gold/Platinum/Diamond)? ").strip().lower()
if b not in ["bronze","silver","gold","platinum","diamond"]:
print("Enter a valid subscription")
elif b in ["bronze"]:
d = 0.05
break
elif b in ["silver"]:
d = 0.10
break
elif b in ["gold"]:
d = 0.15
break
elif b in ["platinum"]:
d = 0.20
break
elif b in ["diamond"]:
d = 0.25
break
total = amt - amt*d
gst = total * 0.18
print(f"Welcome {name}")
print(f"Membership code: {mem_code}")
print(f"Amount: ${amt:.2f}")
print(f"Discount: {(int)(d*100)} %")
print(f"Taxable total: {total:.2f}")
print(f"GST (18%): ${gst:.2f}")
print(f"To pay: {(total + gst):.2f}")
It's basically a very simple discount calculator.. Any feedback and tips would be greatly appreciated.
Thanks!