6.00.1x Week 2 (Problem Set)

This week’s problem set deals with programming scripts that show what is the minimum amount of money a student has to pay in order to pay off his credit card balance in one year.

There are 12 months in a year, and each month, interest will be incurred on the balance, the updated balance after one month with interest incurred can be computed using the formula:

Updated balance each month = (Monthly unpaid balance) + (Monthly unpaid balance × Monthly interest rate)
Monthly unpaid balance = Balance − Monthly payment
Monthly interest rate = Annual interest rate / 12.0
Minimum monthly payment = Balance × Minimum monthly payment rate


The first script shows the minimum monthly payment and remaining balance after each month, and at the end of one year, how much is paid total in one year and the remaining balance. The first script assumes that the student only pay minimum monthly payment each month.


The second script shows how much money the student has to pay in order to clear the balance in one year. The output is a fixed amount that the student has to pay each month. This script uses the linear search (exhaustive enumeration) starting with 0 with step 10. This method is not so accurate because the step size is big, we cannot get an accurate answer, the answer is a multiple of 10.


The third script has the same purpose as the second script. However, this script uses the bisection search to find the fixed amount that the student has to pay each month. This is better than the second script because bisection search is fast, and can find answer accurate to few decimal places.

My Codes: https://github.com/shaunlgs/MITx-6.00.1x-OCW-2014

One thought on “6.00.1x Week 2 (Problem Set)”

  1. hi!
    I figured out a wee shorter way to solve q3. check this out:

    balance = 999999
    annualInterestRate = 0.18
    lower = balance/12
    upper = (balance * (1 + annualInterestRate / 12)** 12) / 12.0
    epsilon = 0.01

    def payfunc(lower, upper):
    payment =(lower+upper)/2
    return payment

    def duetopay(balance,annualInterestRate):
    balance1 = balance
    for month in range(0,12):
    payment = payfunc(lower, upper)
    balance1 = balance1 – payment
    balance1 = balance1 + (annualInterestRate/12)*balance1
    month += 1
    return balance1

    while abs(round(duetopay(balance,annualInterestRate),2)) > epsilon:
    payment = payfunc(lower,upper)
    balance1 = round(duetopay(balance,annualInterestRate),2)
    if balance1 0:
    lower = payment
    print (‘Lowest Payment: ‘ + str(round(payment,2)))

Leave a Reply