Apr-03-2019, 08:56 AM
It seems to me that it easier to write working example then to correct mistakes in your code.
Following is the simple function which calculates reminder of the loan based on loan, annual interest rate, constant payment and number of years:
Following is the simple function which calculates reminder of the loan based on loan, annual interest rate, constant payment and number of years:
def loan_reminder(loan, annual_interest_rate, payment, years): principal = loan for year in range(years): # repeat process for every year interest = principal * annual_interest_rate # calculate interest accrued principal = principal + interest - payment # calculate new principal if principal <= 0: # check whether loan is repaid return 0 # if loan repaid return 0 as loan reminder return principal # return loan reminder after years loan_reminder(10000, 0.05, 1000, 5) 7237.184375000001
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.