0

I want to add a total paid variable to my code, but i couldnt think of any formula to sum the minimum payments and give me a total, my code is program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month. and i want that at the end it said like how much have you paid over the year

balance = 5000.00
monthlyPaymentRate = 0.02
annualInterestRate = 0.18
interest = annualInterestRate * balance

monthly_interest_rate = annualInterestRate / 12
month = 1

while (month < 13):

 minumi_monthly_paymente =  monthlyPaymentRate * balance
 monthly_unpaid_balance = balance - minumi_monthly_paymente
 updated_balance_each_month = monthly_unpaid_balance + (monthly_interest_rate * monthly_unpaid_balance)
 unpaidbalance = balance - minumi_monthly_paymente



 TotalPaid= minumi_monthly_paymente 


 print "month: " + str(month)
 print "minumum month paymente: " + str(round(minumi_monthly_paymente, 2))
 print "Remaining balance: " + str(round(unpaidbalance, 2))
 balance = unpaidbalance + monthly_interest_rate * unpaidbalance 
 month = month + 1

print "Total paid:"  
print "Remaining balance: " + str(round(unpaidbalance))
2
Contributors
1
Reply
13
Views
4 Years
Discussion Span
Last Post by pyTony
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.