Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Opcion1
- month = 1
- totalPaid = 0
- for month in range(1,12):
- minMonthlyPayment = monthlyPaymentRate * balance
- interest = (balance - minMonthlyPayment) * (annualInterestRate / 12)
- updatedMonthlyBalance = balance + interest - minMonthlyPayment
- print('Month: ' + str(month))
- print('Minimun monthly payment: ' + str(round(minMonthlyPayment,2)))
- print('Updated balance each month: ' + str(round(updatedMonthlyBalance,2)))
- month += 1
- totalPaid += minMonthlyPayment
- balance = updatedMonthlyBalance
- print('Total paid: ' + str(round(totalPaid, 2)))
- print('Remaining balance: ' + str(round(updatedMonthlyBalance, 2)))
- #Opcion2
- def ccbalance(balance, annualInterestRate, monthlyPaymentRate):
- month = 1
- totalPaid = 0
- while month < 13:
- minMonthlyPayment = monthlyPaymentRate * balance
- interest = (balance - minMonthlyPayment) * (annualInterestRate / 12)
- updatedMonthlyBalance = balance + interest - minMonthlyPayment
- print('Month: ' + str(month))
- print('Minimun monthly payment: ' + str(round(minMonthlyPayment,2)))
- print('Updated balance each month: ' + str(round(updatedMonthlyBalance,2)))
- month += 1
- totalPaid += minMonthlyPayment
- balance = updatedMonthlyBalance
- print('Total paid: ' + str(round(totalPaid, 2)))
- print('Remaining balance: ' + str(round(updatedMonthlyBalance, 2)))
Add Comment
Please, Sign In to add comment