Skip to content

Instantly share code, notes, and snippets.

@yasoob
Created January 19, 2015 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasoob/937b939b54dbf4d2b225 to your computer and use it in GitHub Desktop.
Save yasoob/937b939b54dbf4d2b225 to your computer and use it in GitHub Desktop.
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