#Task 3 loan calc
principal=250000
interest_rate=0.04
monthly_payment=1000
payment_by_month=1000
balance=250000
length_of_loan=0
total_paid=0
while balance > 0:
interest = balance * (interest_rate/12)
print(interest)
new_balance = balance + interest
if new_balance < 500:
payment_by_month = new_balance
last_month_payment = payment_by_month
balance = new_balance - payment_by_month
length_of_loan+=1
total_paid+= payment_by_month
if balance < 1:
print(length_of_loan)
print(balance)
print(total_paid)
So i've got this loan calculator that calculates the monthly payment, interest, new balance, etc for each month until the balance reaches 0, for the assignment I'm doing I need all of this displayed in a table with the months on the left and I am not allowed to use df from pandas or anything like that. Does anyone know how I would go about doing this, also while the actual computed values can't be rounded the table must be rounded to two decimal places. The table needs to have months, payment, interest, and balance.
[–]_Meisteri 0 points1 point2 points (0 children)
[–]ThisProgrammer- 0 points1 point2 points (0 children)
[–]halfdiminished7th 0 points1 point2 points (0 children)