Guest User

Untitled

a guest
Jan 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. balance = float(input('balance = '))
  2. annualInterestRate = float(input('annualInterestRate = '))
  3.  
  4. monthlyInterestRate = (annualInterestRate)/12
  5. pseudoBalance = balance
  6. paidOff = False
  7. low=balance/12.0
  8. monthlyInterestRate = (annualInterestRate)/12
  9. upper=(balance*(1+annualInterestRate)**12)/12.0
  10. minimumMonthlyPayment = (low+upper)/2.0
  11.  
  12. while paidOff == False:
  13. month = 1
  14. pseudoBalance = balance
  15. for months in range(12):
  16. pseudoBalance = (pseudoBalance - minimumMonthlyPayment)*(1 + monthlyInterestRate)
  17. if pseudoBalance <=0.01:
  18. paidOff=True
  19. break
  20. if(pseudoBalance>=minimumMonthlyPayment):
  21. low=minimumMonthlyPayment
  22. if(pseudoBalance<=minimumMonthlyPayment):
  23. upper=minimumMonthlyPayment
  24.  
  25.  
  26. print("Lowest Payment: "+str(round(minimumMonthlyPayment,2)))
Add Comment
Please, Sign In to add comment