Guest User

Untitled

a guest
Jan 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1. monthlyInteresstRate = annualInterestRate/12
  2.  
  3. remainingBalance = balance
  4. higher = (remainingBalance * (1 + monthlyInteresstRate)**12)/12
  5. lower = remainingBalance/12
  6. monthly_Payment = (higher + lower) / 2
  7.  
  8.  
  9. start = True
  10. while start:
  11.     monthly_Payment = (higher + lower) / 2
  12.     remainingBalance = balance
  13.    
  14.     for i in range(0, 12):
  15.         monthlyInterestRate = annualInterestRate/12
  16.         remainingBalance = (remainingBalance - monthly_Payment) * (1 + monthlyInterestRate)
  17.         if remainingBalance <= 0:
  18.             break
  19.        
  20.    
  21.     if (higher - lower < 0.005):
  22.  
  23.  
  24.         print "Lowest Payment: ", round(monthly_Payment, 2)        
  25.         for i in range(0, 12):
  26.                 monthlyInterestRate = annualInterestRate/12
  27.                 remainingBalance = (remainingBalance - monthly_Payment) * (1 + monthlyInterestRate)
  28.                 print monthlyInterestRate
  29.                 if remainingBalance <= 0:
  30.                     break
  31.        
  32.         break
  33.     elif balance < 0:
  34.         higher = monthly_Payment
  35.     else:
  36.         lower = monthly_Payment
Add Comment
Please, Sign In to add comment