I want to display a message that says "Invalid Discount, Discount should have value 0 to 99" if the user input a user input a number lesser than 0 or greater than 99. I tried to do this on my own, but my program seem to get confused every time i input a number at toyDiscount.
count = "yes"
toyAmount = 1
finalPrice = 0
x = 1
y = 1
while x <= toyAmount:
if count == "yes":
while True:
toyPrice = int(input("Price of Toy " + str(x) + " = Rp."))
if toyPrice <= 0:
print("Invalid Price! The price should be greater than 0")
print("")
else:
while True:
toyDiscount = int(input("Discount #" + str(y) + "(in %): "))
if toyDiscount == 0:
print("Price = " + str(toyPrice))
break
else:
toyPrice = toyPrice * (1 - toyDiscount/100)
y = y + 1
finalPrice += toyPrice
print("")
count = input("More Toys to buy (yes/no)? = ")
print("")
x += 1
toyAmount += 1
y=1
break
else:
coup = finalPrice // 25000
print("Final Price = " + str(finalPrice))
print("You get %d gift voucher" %(coup))
break