Guest User

Untitled

a guest
Jan 15th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. mir = annualInterestRate / 12
  2. low = balance/12
  3. high = (balance*(1 + mir)**12)/12
  4. epsilon = 0.01
  5. mp = (high + low)/2.0
  6. ob = balance
  7. while abs(balance) >= epsilon:
  8.     balance = ob
  9.     for month in range(0, 12):
  10.         balance = (balance - mp) * (1+mir)
  11.     if  balance > 0:
  12.         low = mp
  13.     else:
  14.         high = mp
  15.     mp = (high + low)/2.0
  16. else: print "Lowest Payment: " + str(round(mp, 2))
Add Comment
Please, Sign In to add comment