Advertisement
superpawko

Untitled

Sep 27th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. balance = 3329
  2. annualInterestRate = 0.2
  3.  
  4.  
  5. def lowestPayment(balance, annualInterestRate, monthlyPayment=10):
  6. monthlyInterestRate = annualInterestRate/12
  7. nbalance = balance
  8. print("PAY: ", monthlyPayment, end=" ") # REMOVE THIS BEFORE POSTING
  9.  
  10. for months in range(12):
  11. nbalance -= monthlyPayment
  12. nbalance += monthlyInterestRate * nbalance
  13.  
  14. print("BAL: ", round(nbalance,1)) # REMOVE THIS BEFORE POSTING
  15. if nbalance < 0:
  16. return monthlyPayment
  17. else:
  18. return lowestPayment(balance, annualInterestRate, monthlyPayment + 10)
  19.  
  20. print("Lowest Payment: {}" .format(lowestPayment(balance, annualInterestRate)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement