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
shout out @LT_Forest for tip to build solution in excel—saved hours of grief!!
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.
i concur! and used it to build pseudo code right into the spread sheet. thanks for sharing, here's mine. cheers
yours is much prettier and complete than mine :>)
@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.
@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. : )
That's exactly what I meant. The for-loop is providing you with this incrementing variable, so why not use it? ;)
Join our real-time social learning platform and learn together with your friends!