def setup():
loan_amount=5000
interestRate=12
months=12
cal_loan(5000,12,12)
def cal_loan(loan_amount, interestRate, months):
n=1
term=1
total_interest=0
effectiveInterest=interestRate/(100*12)
monthlyPayment=loan_amount*(effectiveInterest/(1-pow(1+effectiveInterest,-months)))
balance=loan_amount
print("Loan Amount $ = ",loan_amount)
print("Loan Term = ",months," month(s)")
print("Interest Rate = ",interestRate,"%")
print("Payment per months = ",monthlyPayment)
print("Payment No. | Interset | Principal | Unpaid Balance | Total Interest to Date")
while(term<=months):
interest = effectiveInterest*balance
principal=monthlyPayment-interest
balance=balance-principal
total_interest=total_interest+interest
print(" ",term," $",interest," $",principal," $",balance," $",total_interest)
term=term+1
setup()
No comments:
Post a Comment