SHARE
TWEET

Untitled

a guest Jan 20th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. balance = 320000
  2. annualInterestRate = 0.20
  3.  
  4. monthlyInterestRate = annualInterestRate / 12
  5. MonthlyPaymentLowerBound = balance / 12
  6. MonthlyPaymentUpperBound = balance * ((1 + monthlyInterestRate)**12 / 12)
  7. balance2=balance
  8. ans=round((MonthlyPaymentLowerBound + MonthlyPaymentUpperBound) / 2.0+0.01, 8)
  9.  
  10. while True:
  11.    
  12.    
  13.     for month in range(12):
  14.         balance2=balance2-ans
  15.         balance2=balance2 + balance2 * monthlyInterestRate
  16.     if abs(balance2) < 0.08:
  17.         break;
  18.    
  19.     if balance2 > 0:
  20.         MonthlyPaymentLowerBound=ans
  21.     elif balance2 < 0:
  22.         MonthlyPaymentUpperBound=ans
  23.  
  24.     ans=round((MonthlyPaymentUpperBound+MonthlyPaymentLowerBound)/ 2.0+0.01,8)
  25.     balance2=balance
  26.  
  27. print('Lowest payment: ' + str(round(ans,2)))
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