Solution for Problem one EdX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def payment(month, balance, AIRate, MPRate): | |
minimumPayment = balance * MPRate | |
remainingBalance = balance - minimumPayment | |
unpayedBalance = balance-minimumPayment | |
interest = (AIRate/12) * unpayedBalance | |
balance = unpayedBalance + interest | |
print "Month:", month | |
print "Minimum monthly payment: %.2f" %(minimumPayment) | |
print "Remaining balance: %.2f \n" %(unpayedBalance) | |
return balance | |
def loop_months(balance, AIRate, MPRate): | |
for month in range(12): | |
balance = payment(month, balance, AIRate, MPRate) | |
loop_months(5000, 0.18, 0.02) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment