Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- balance = 3329
- annualInterestRate = 0.2
- def lowestPayment(balance, annualInterestRate, monthlyPayment=10):
- monthlyInterestRate = annualInterestRate/12
- nbalance = balance
- print("PAY: ", monthlyPayment, end=" ") # REMOVE THIS BEFORE POSTING
- for months in range(12):
- nbalance -= monthlyPayment
- nbalance += monthlyInterestRate * nbalance
- print("BAL: ", round(nbalance,1)) # REMOVE THIS BEFORE POSTING
- if nbalance < 0:
- return monthlyPayment
- else:
- return lowestPayment(balance, annualInterestRate, monthlyPayment + 10)
- print("Lowest Payment: {}" .format(lowestPayment(balance, annualInterestRate)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement