Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Solution for Problem one EdX
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