Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- annualInterestRate=.2
- balance=320000
- monthlyInterestrate=annualInterestRate/12
- balance_initial=balance
- lowerbound=(1/12)*balance
- upperbound=balance*(1+monthlyInterestrate)**(12)/12
- monthlyPayment=(upperbound+lowerbound)/2
- while balance>-.00001 and balance<.00001:
- for i in range(12):
- balance=balance-monthlyPayment + (balance-monthlyPayment)*monthlyInterestrate
- if balance>0:
- lowerbound=monthlyPayment
- if balance<0:
- upperbound=monthlyPayment
- print('Lowest Payment: ' + str(round(monthlyPayment, 2)))
Add Comment
Please, Sign In to add comment