Advertisement
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):
- try:
- 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
- except:
- return 'Error'
- # print(calculateMonthlyPayment(1000.0, 4.5, 5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement