Guest User

Untitled

a guest
Jan 21st, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. balance = 999999
  2. annualInterestRate = 0.18
  3. balance2=balance
  4. low= balance / 12
  5. high=balance*((1 + annualInterestRate/12)**12 /12)
  6. ans=round((low+high)/2, 2)
  7. balance2=balance
  8.  
  9. while balance2 > 0:
  10.     for month in range(1, 13):
  11.         balance2=(balance2- ans)*(1 + annualInterestRate/12)
  12.      
  13.     if balance2 < 0.01:
  14.             break
  15.     if balance2 > 0:
  16.             low=ans
  17.  
  18.     elif balance2 < 0:
  19.             high=ans
  20.  
  21.     ans=(low+high)/2
  22.     balance2=balance
  23.  
  24.    
  25. else:
  26.     ans=round(ans, 2)
  27.     print('Lowest Payment: ' + str(ans))
Add Comment
Please, Sign In to add comment