#!/usr/bin/env python import sys import os """ Author : flo date : 2017.02.13 Purpose : example of finding out the amount of principle paid to mortgage lender per year. : Comments: Simulate the number of mortgage payments based on the loan amount : : This will prompt you for inputs, this is simply an estimate of the remaining : amount of your mortgage. To me, this is a simulation where one can view the amount : of interest on a daily basis. Interestingly enough, it does add up ! : usage : python mortgage2.txt """ def count(): # 250000 or more but borrowing more than this amount is kind of dangerous, unless you work for google.com ttot = raw_input("Enter a loan amount ? ") # 300.99 or something else tint = raw_input("Enter a monthly interests amount for ESCROW? ") # 4.975 or something else 15 year mortgage rate is best trate = raw_input("Enter a interest rate ? ") # 36 or 52 or more, depends what you want to see tmon = raw_input("Enter a loan terms in months ? ") # the amount you are current paying or a hypothetical amount, 1200 tpal = raw_input("Enter your monthly Principle ? ") mon = int(tmon) rate = float(trate)/100.00 intr = float(tint) pal = float(tpal) # 250,000 is the amount from bank as a loan tot, sum = float(ttot), 0 # 12 months of the year for i in range(1, mon+1): # assuming 30 days per-month for x in range(1, 31): # .0450 is the interest amount sum = tot * rate * (1.00 / 365.00) tot = sum + tot print "Month\t" + str(i) + " Day\t" + str(x) + "\t" + str(round(tot, 2)) + "\t" + str(round(sum, 2)) # 650 is the amount of principle per month tot -= (pal + intr) def main(): count() # calling main if __name__ == "__main__": main()