Last active
July 26, 2018 07:50
-
-
Save shinpei/3bc31aa8d032fb99f6a56f35e017770f to your computer and use it in GitHub Desktop.
calculate mortgage loan
This file contains 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
years=25 | |
amount = 45000000 | |
bonus=300000 | |
yearlyPay= 120000 | |
def yearPay(): | |
pay = 0 | |
pay += bonus * 2 | |
pay += yearlyPay * 12 | |
return pay | |
interest = 1.35 / 100.0 | |
leftover = amount | |
totalPay = 0 | |
for i in range(1,years): | |
yp = yearPay() | |
leftover -= yp | |
totalPay += yp | |
leftover *= (1.0 + interest) | |
print "%dth year (%d): leftover = %d, totalPay= %d" % (i, 35 + i, leftover, totalPay) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment