Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- balance = 320000
- annualInterestRate = 0.2
- monthlyInterestRate = (annualInterestRate)/12
- lowerBound = balance/12
- upperBound = (balance*(1+monthlyInterestRate)**12)/12
- payment = (upperBound + lowerBound)/2
- newBalance = balance
- while abs(newBalance) > 0.01:
- for month in range(1, 13):
- newBalance = (balance - payment) * (1 + monthlyInterestRate)
- if newBalance > 0:
- upperBound = payment
- elif newBalance < 0:
- lowerBound = payment
- else:
- break
- payment = (upperBound + lowerBound)/2
- newBalance = balance
- print 'Lowest Payment: ', round((payment), 2)
Add Comment
Please, Sign In to add comment