Created
March 4, 2014 20:51
-
-
Save beauvais/9355359 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
value = 138000 | |
deposit = 10000 | |
loan = value - deposit | |
apr = 4.5 | |
years = 30 | |
months = years * 12 | |
rate = apr / 100 | |
monthly_rate = rate / 12 | |
""" | |
The formula is M = P * ( J / (1 - (1 + J)^ -N)). | |
M: monthly payment | |
P: principal or amount of loan | |
J: monthly interest; annual interest divided by 100, then divided by 12. | |
N: number of months of amortization, determined by length in years of loan. | |
""" | |
from math import * | |
def find_monthly_payment(value, deposit, apr, years): | |
loan = value - deposit | |
months = years * 12 | |
rate = apr / 100 | |
monthly_rate = rate / 12 | |
monthly_payment = loan * (monthly_rate / (1-(pow((1 + monthly_rate),- months)))) | |
return monthly_payment | |
pass | |
print(find_monthly_payment(138000,10000,4.5,30)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment