SHARE
TWEET

Untitled

a guest Jun 26th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. balance = 320000
  2. annualInterestRate = 0.2
  3.  
  4. low = balance / 12.0
  5. high = balance
  6. guess = (high + low) / 2.0
  7.  
  8. while True:
  9.     tempBal = balance
  10.     for month in range(1, 13):
  11.         tempBal -= guess  # remove guess from the unpaid balance
  12.         tempBal += (annualInterestRate/12.0) * tempBal  # calculate the monthly interest and add the monthly interest to the balance
  13.  
  14.     if tempBal <= 0:
  15.         break
  16.     else:
  17.         if guess < tempBal:
  18.             low = guess
  19.         else:
  20.             high = guess
  21.         guess = (high + low) / 2.0
  22.  
  23. print('Lowest Payment: ', round(guess))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top