Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- balance = float(input('balance = '))
- annualInterestRate = float(input('annualInterestRate = '))
- monthlyInterestRate = (annualInterestRate)/12
- pseudoBalance = balance
- paidOff = False
- low=balance/12.0
- monthlyInterestRate = (annualInterestRate)/12
- upper=(balance*(1+annualInterestRate)**12)/12.0
- minimumMonthlyPayment = (low+upper)/2.0
- while paidOff == False:
- month = 1
- pseudoBalance = balance
- for months in range(12):
- pseudoBalance = (pseudoBalance - minimumMonthlyPayment)*(1 + monthlyInterestRate)
- if pseudoBalance <=0.01:
- paidOff=True
- break
- if(pseudoBalance>=minimumMonthlyPayment):
- low=minimumMonthlyPayment
- if(pseudoBalance<=minimumMonthlyPayment):
- upper=minimumMonthlyPayment
- print("Lowest Payment: "+str(round(minimumMonthlyPayment,2)))
Add Comment
Please, Sign In to add comment