Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 7 Online
OpenStudy (anonymous):

Problem Set 1, Question 2: balance = float(raw_input("Enter initial credit card balance: ")) annualInterestRate = float(raw_input("Enter annual interest rate: ")) annualInterest = balance * annualInterestRate minMonthlyPayment = (balance + annualInterest) / 12.0) # Monthly Interest Rate monthlyInterestRate = annualInterestRate / 12.0 # Number of Months needed to pay off balance numMonths = 0 while balance > 0: balance = balance - minMonthlyPayment + (monthlyInterestRate * balance) numMonths += 1 print "Monthly Payment to pay off debt in 1 year: $", minMonthlyPay

OpenStudy (anonymous):

As far as I can tell from the question you need to increment through monthly payments +=10 until you find the lowest that can be paid each month so as the debt will be cleared within a year. I don't see that in your code. You should test this with the same figures that are in the test cases and compare results.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!