Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

just finished solution to MIT-6.00SC PS01a—moving on to PS01b, and PS01c. but if anyone has the inclination, please give feedback.. the code is posted at pastebin . as my first python script, i'm sure the code could use refinement—the currency/float point issue alone, is problematic, and a good topic for research! thx, --mazal 2013.12.27 update: url updated to reflect code changes, from feedback.

OpenStudy (anonymous):

shout out @LT_Forest for tip to build solution in excel—saved hours of grief!!

OpenStudy (anonymous):

I deliberately built it manually in excel to force myself to go through each iteration of the loop in my head until completion. It gave me a sense of how the computer would solve the problem and allowed me to think about how the objects would point to one another after each step. It was a very useful exercise for me in helping to build the logic necessary to start the project. I have attached the file here. Hopefully it helps.

OpenStudy (anonymous):

i concur! and used it to build pseudo code right into the spread sheet. thanks for sharing, here's mine. cheers

OpenStudy (anonymous):

yours is much prettier and complete than mine :>)

OpenStudy (anonymous):

@mazal: Your code is very readable and structured. The only thing, I found, that might be improved is the counting of the months. You have the variable "month" and the variable "num" from the for loop, You need only one of them.

OpenStudy (anonymous):

@doxanthropos, excellent. ahh.. so, my for loop can recycle the same 'month' object(?) ? ``` for month in range(1,13): balance = float(remaining_balance) min_mo_pay = float(min_mo_pay_rate * balance) interest_pd = float(an_interest_rate/12) * float(balance) …etc. ``` is this what you meant? i changed it, and seems to work fine. : )

OpenStudy (anonymous):

That's exactly what I meant. The for-loop is providing you with this incrementing variable, so why not use it? ;)

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!