maincarry May 15th, 2016 22 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- Part 2: Loan
- By Mark Wu 3217
- def calculateRemainingLoanBalance(principal, annualInterestRate, duration, number_of_payments):
- n = duration * 12 # n is the total month
- if annualInterestRate != 0:
- r = annualInterestRate / 100 / 12 # r is the monthly interest rate
- r = principal / n
- p = number_of_payments
- result = principal * ((1+r)**n - (1+r)**p) / ((1+r)**n - 1)
- return result
- return 'Error'
- # print(calculateRemainingLoanBalance(1000.0, 4.5, 5, 12))
RAW Paste Data