Problem set#1- Problem , course 6 00 Hi! I;m having a problem with the first problem of the problem set 1. I tried solving it with a for or while loop, trying to explain the computer to compute the new balance by substracting the principal paid from the previous balance and then compute the whole equation again. Didn't work. Finally gave in and wrote 12 sets for each month, but can't say I'm proud of myself for doing that. Can you help me make it neater?
It should be easy to convert your long version into a loop. Do you still have the code with the loops? If so post it and we'll have a look. Or post your long version. please use a code pasting site: - http://dpaste.com - http://pastebin.com - https://gist.github.com/ - http://pastie.org - http://codepad.org - http://ideone.com - http://www.repl.it/ paste your code there and post the link here. select Python syntax highlighting when u paste. Have you read thru the Tutorial in the Python documentation? Are you familiar with the range() or xrange() functions? You want to put all the calculations inside the for loop, and you want it to perform those calcs 12 times. something like this: ``` a = 0 for n in xrange(10): a += n print a ```
I think I see the problem. I figured to put the calculations inside the for loop, but left the print outside. Now it seems to make more sense. thank you!
yeay!
All working swimmingly, except the total amount paid..how do I do that?
on each iteration you need to accumulate the amount paid - similar to the example in my previous post
all done! Awesome! Thank you so much for your help!
yeay again!
thanks
Join our real-time social learning platform and learn together with your friends!