Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. loan_balance = 500000
  2. annual_interest_rate = 4.5/100
  3.  
  4. total_repayments = 360 #Monthly repayments for a 30 year home loan
  5. monthly_interest_rate= annual_interest_rate/12
  6.  
  7. min_repayment_amount = -np.pmt(monthly_interest_rate, total_repayments, loan_balance)
  8.  
  9. principal_paid = 0
  10. payment_number = 1
  11. while payment_number <= 10:
  12. interest_part = -np.ipmt(monthly_interest_rate, payment_number, total_repayments, loan_balance)
  13. principal_part = -np.ppmt(monthly_interest_rate, payment_number, total_repayments, loan_balance)
  14.  
  15. print(round(min_repayment_amount, 2), "|", round(interest_part, 2), "|", round(principal_part, 2))
  16.  
  17. principal_paid += principal_part
  18. payment_number += 1
  19.  
  20. print("Balance after payment# 10:", loan_balance - principal_paid)
  21.  
  22. '''
  23. Output
  24.  
  25. 2533.43 | 1875.0 | 658.43
  26. 2533.43 | 1872.53 | 660.9
  27. 2533.43 | 1870.05 | 663.37
  28. 2533.43 | 1867.56 | 665.86
  29. 2533.43 | 1865.07 | 668.36
  30. 2533.43 | 1862.56 | 670.86
  31. 2533.43 | 1860.05 | 673.38
  32. 2533.43 | 1857.52 | 675.91
  33. 2533.43 | 1854.99 | 678.44
  34. 2533.43 | 1852.44 | 680.98
  35. Balance after payment# 10: 493303.50660926406
  36. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement