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