Jul-19-2018, 02:03 AM
I edited my code to
For instance, a balance of 320000 and an annualInterestRate of .2 should yield "Lowest Payment: 29157.09" but I'm getting 29591.88
I'm quite confused as to why this still isn't working.
annualInterestRate=.1 balance=100 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: monthlyPayment=(upperbound+monthlyPayment)/2 if balance<0: monthlyPayment=(lowerbound+monthlyPayment)/2 print('Lowest Payment: ' + str(round(monthlyPayment, 2)))but now everything is off by a small amount.
For instance, a balance of 320000 and an annualInterestRate of .2 should yield "Lowest Payment: 29157.09" but I'm getting 29591.88
I'm quite confused as to why this still isn't working.