This program calculates depreciation
I want to keep asking user for input until it gives the valid input.
def CalculateDep(amount,nofYears,rate,yearOfPurchase):
for i in range(nofYears):
if (mop.lower() == "n" and i == 0):
percentile = rate * 0.005
elif(mop.lower() == "y" or mop.lower() == "n"):
percentile = rate * 0.01
dep = round((percentile)*amount, 2)
print("") # print blank line for readiblity
print("Dep Charge @" + str(percentile*100) + " % : " + str(dep))
print("On 31-03-" + str(yearOfPurchase+1))
amount = amount - (dep)
yearOfPurchase += 1
print("Value After Depreciation : " + str(round(amount, 2)))
amt = int(input("Enter the Amount : ")) #Initial value of asset
y = int(input("Enter the Number of years : "))
r = float(input("Enter The depreciation Rate : "))
yop = int(input("Enter The Year in Which The Asset is purchased : "))
mop = input("Purchased asset before 1st October ? Answer y or n : ")
CalculateDep(amt, y, r, yop)