Guest User

Untitled

a guest
Jan 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. x=balance
  2.  
  3. m=annualInterestRate/12
  4. x1=balance / 12
  5. x2=(balance * (1 + m)**12)/12
  6. updatedBalance = balance
  7.  
  8. while abs(x1-x2)>0.0001:
  9.     x=(x1+x2)/2
  10.     updatedBalance = balance
  11.     for _ in xrange(12):
  12.         updatedBalance = (updatedBalance - x) * (1 + m)
  13.     if  updatedBalance>0:
  14.         x1=x
  15.     elif updatedBalance<0:
  16.         x2=x
  17.    
  18. print 'Lowest Payment: ', round(x,2)
Add Comment
Please, Sign In to add comment